Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- /********************************************************/
- #define MAX 200
- /********************************************************/
- int readCommands( char c [ ] );
- /********************************************************/
- int main( void ) {
- char commands[ MAX ] = { 0 };
- int ncmds;
- int count;
- ncmds = readCommands( commands );
- for(count = 0;count<ncmds;count++){
- fprintf(stdout,"%1s\n",&commands[count]);
- }
- printf("ncmds:%d\n",ncmds);
- return 0;
- }
- /***********************************************************/
- int readCommands( char commands[] ) {
- int ncmds = 0;
- int count = 0;
- char val;
- while(fscanf(stdin, "%1s\n",& val) != EOF){
- fprintf(stdout, "\n Letter: %1s", &val);
- commands[ncmds] = val;
- ncmds = ncmds + 1;
- }
- return ncmds;
- }
- /*************************************************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement