Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #define MAX_LEN 128
- int reverse_word_and_print(char (*), int);
- main(){
- int w=0, rv;
- char words[MAX_LEN][MAX_LEN];
- do{
- scanf("%s", words[w]);
- rv=reverse_word_and_print(words[w], strlen(words[w]));
- w++;
- }while(rv==0);
- return 0;
- }
- int reverse_word_and_print(char (*stringPtr), int size){
- int i;
- i=size;
- if((strcmp("stop", stringPtr))!=0){
- while( i --> 0 )
- putchar(stringPtr[i]);
- printf(" %d\n", size);
- return 0;
- }
- else
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement