Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <malloc.h>
  3. #include <string.h>
  4.  
  5. int S(char *m)
  6. {
  7.     int k = 0;
  8.     while (*(m + k ++));
  9.     // если вводить строку: abc
  10.     // 1) 1 + 0 = 1 != 0;
  11.     // 2) 2 + 1 = 3 != 0;
  12.     // 3) 3 + 2 = 5 != 0;
  13.     // 4) 0 + 3 = 3 != 0;
  14.     return k;
  15. }
  16.  
  17. int main()
  18. {
  19.     char *n;
  20.     n = (char *)malloc (200);
  21.     scanf ("%s", n);
  22.     printf ("%d", S(n));
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement