Word backwards! stupid problem!!!
I forgot how to do it, dont know what is wrong, help! Output is some crap...
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char *funk(char *);
int main()
{
int sranje;
char niz[30];
char *n1,*p;
printf("Recenica: ");
gets(niz);
n1=(char *)malloc(sizeof(char)*(sizeof(niz)));
strcpy(n1,niz);
p=funk(n1);
printf("%s", p);
scanf("%d", &sranje);
}
char *funk(char *n1){
char *p;
int i;
p=(char *)malloc(sizeof(char)*(sizeof(n1)));
for(i=strlen(n1)-1;i==0;i--)
{
p[i]=n1[i];
}
return p;
}