this was a question from my first exam and it says
write a c function which takes a string(as a character array, null terminated) and reverses it. it doesn't print the reversed string -- it modifies the given string so that it is reversed.
how come this doesn't work?Code:void reverse(char array[]) { char tmp; int i, j; for(i=0;i<strlen(array); i++) { for(j=strlen(array)-1;j>=0;j--) { tmp = array[i]; array[i] = array[j]; array[j] = tmp; } } }