1 /* Calculates the length of a string and prints it on stdout */ 2 3 #include <stdio.h> 4 5 int main(void) { 6 7 char s[] = "Hello world!\n"; 8 int i; 9 10 for(i = 0; s[i]; i++) 11 ; 12 13 printf("%d\n", i); 14 15 return 0; 16 }
9511_workbooksolved exercises from algorithms & programming I (9511) prof. Cardozo |