StrReverse by linkgl
Publicado: 29 Sep 2011, 17:18
Lo usé en un problema que me dejaron resolver
Código: Seleccionar todo
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//StrReverse->
char *strrev(char *palabra)
{
int largo,i,j;
char *temp;
largo=strlen(palabra);
temp=(char *)malloc(largo);
memset(temp,0,largo);
for(i=largo-1,j=0;i>=0;i--,j++)
temp[j]=palabra[i];
return temp;
}
//->Uso
int main()
{
printf(strrev("linkgl"));
getchar();
return 0;
}