Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #define MAX 100
- //prototipo
- void inverteString(char *s);
- int main()
- {
- char s[MAX];
- printf("Digite uma palavra: ");
- gets(s);
- inverteString(s);
- printf("\nInvertida: %s\n", s);
- return 0;
- }
- void inverteString(char *s)
- {
- char *auxS, aux[MAX];
- int i=0, tam;
- auxS=s;
- tam=strlen(auxS);
- for(i=0;i<tam;i++)
- aux[i]=auxS[(tam-1)-i];
- for(i=0;i<tam;i++)
- auxS[i]=aux[i];
- }
Advertisement
Add Comment
Please, Sign In to add comment