Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<string.h>
- #define MAX 100
- void inverteString(char *s);
- int main( int argc, char *argv[])
- {
- int i;
- char nome[MAX];
- strcpy(nome,argv[1]);
- inverteString(nome);
- printf("%s",nome);
- return 0;
- }
- void inverteString(char *s)
- {
- int i;
- char *aux;
- aux=s;
- char *novaString =(char*)malloc(sizeof(strlen(aux)));
- for(i=0;i<strlen(aux)+1;i++){
- novaString[strlen(aux)-(i+1)]=aux[i];}
- strcpy(aux,novaString);
- }
Advertisement
Add Comment
Please, Sign In to add comment