Advertisement
apl-mhd

pointerStringLength

Dec 17th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(int argc, char **argv)
  4. {
  5.    
  6.    
  7.     char str[100];
  8.    
  9.    
  10.     char *ch;
  11.     int n, count;
  12.    
  13.     count = 0;
  14.    
  15.    
  16.    
  17.     ch = str;
  18.    
  19.     gets(str);
  20.    
  21.    
  22.     for(n=0; ch[n] != '\0'; n++){
  23.        
  24.             count++;
  25.            
  26.         }
  27.        
  28.        
  29.         printf("Total word = %d\n", count);
  30.        
  31.        
  32.    
  33.    
  34.    
  35.    
  36.    
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement