I want to print all the characters (including spacing and special characters) in a sring in reverse order. But the program fail to do it. :confused
Can anyone tell me what's wrong in my program?? am i use the wrong sequence?
Thank you so much.
# include <stdio.h>
char string; //global variable
int i=0, num = 0, item=0;
printf ("String : ");
scanf ("%[^\n]", string);
while (s = (string[i]) != '\0')
printf ("num = %d\n", num);
for (i= num-1; string[i] <= 0;i--)
string[item] = string[i];
printf ("\nString Reverse = %s \n", string);