January 6th, 2013, 03:29 AM
I have written c code for string reversal.
Program compiles without any error.
But it gives runtime error.
I am not able to catch the code in my error, Please help me.
The code is as follows.
char *source= "Hello";
char *result= " ";
int n_count = 0;
for ( n_loopcount = 0; n_loopcount<n_count;n_loopcount++)
*result = *source;
January 6th, 2013, 03:49 AM
result only has two bytes - it's not long enough to hold a copy of source.