Advertisement
Broatlas

Untitled

Feb 19th, 2016
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.81 KB | None | 0 0
  1. #include <stdio.h>
  2. /********************************************************/
  3. #define MAX 200
  4. /********************************************************/
  5. int readCommands( char c [ ] );
  6. /********************************************************/
  7. int main( void ) {
  8.     char commands[ MAX ] = { 0 };
  9.     int ncmds;
  10.     int count; 
  11.     ncmds = readCommands( commands );
  12.     printf("Array begings\n"); 
  13.     for(count = 0;count<ncmds;count++){
  14.         printf("%c\n",&commands[count]);
  15.     }
  16.     printf("ncmds:%d\n",ncmds);
  17.     return 0;
  18.     }
  19. /***********************************************************/
  20. int readCommands( char commands[] ) {
  21.  
  22.     int ncmds = 0;
  23.     char val;
  24.     while(fscanf(stdin, "%c",&val) != EOF){
  25.         commands[ncmds] = val;
  26.         ncmds++;
  27.     }  
  28.     return ncmds;
  29.     }
  30.  
  31. /*************************************************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement