im trying to store my reverse array and call it back in main then print it out in main but it in the reverse function, the temp wont copy into the a array.
Why?
in the reverse function if i do a for loop and printf whats stored in the temp array then its the reverse of what the input is, however when i try to copy the temp array into the a array then print it out in main, it just prints out the input string. Its as if no copying has been done.
what have i done wrong?
Code:void reverse( char a[] ) { int i; int n=0; char temp[SIZE]; for( i=strlen(a); i >= 0; i--) { temp[n] = a[i]; n++; } temp[n] = '\0'; strcpy( a, temp ); }