#include<stdio.h>
#include<string.h>
#include<stdlib.h>
void main() {
int i, j, k=0;
int len;
char *rev[3];
char *s[]={
"To err is human...",
"But to really mess things up...",
"One needs to know c!!"
};
for (i=0; i<3; i++) {
len=strlen(s[i]);
rev[i]=malloc(strlen(s[i])+1);
for (j=len-1; j>=0; j--) {
rev[i][k]=s[i][j];
k++;
}
rev[i][k]='\0';
}
for (i=0; i<3; i++)
printf("%s\n", rev[i]);
}
This program compiles fine but does not run. Can anyone point out the logical error or conceptual? I'm trying to reverse the string here...