so this is the code for reversing a string
#include<stdio.h>
char* function(char *);
int main()
{
char a[]="computer";
printf("%s", function(a));
return 0;
}
char* function(char *p)
{
int l,i;
char t;
for (l=0;*(p+l)!='\0';l++);
for(i=0; i<(l/2) ; i++)
{
t=*(p+i);
*(p+i)=*(p+l-1-i);
*(p+l-1-i)=t;
}
return (p);
}
but if i change printf("%s", function(a));
in the main body to
printf("%s", function("computer"));
there is no output (the output is blank) in dev c++.... but it gives the desired output in turbo c++ even with this change....why is that?