.
This commit is contained in:
18
bac2/os/chap0/ex1.c
Normal file
18
bac2/os/chap0/ex1.c
Normal file
@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
unsigned int string_length(char string[]);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("%d", string_length("test"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int string_length(char string[]){
|
||||
int i = 0;
|
||||
while(string[i] != '\0'){
|
||||
i++;
|
||||
}
|
||||
return i;
|
||||
}
|
Reference in New Issue
Block a user