Hi, while I was looking at a program in my textbook, i encountered this program to reverse a string using recursive procedure-
#include <stdio.h>
int main(void)
{
void rev();
printf("Enter a line of text:\n");
rev();
}
void rev()
{
char c[20];
if((c==getchar())!='\n')
rev();
putchar(c);
}
I couldn't quite understand the logic the author used, so I went to check the program on my pc which gave the error-
Runtime error(Exit status:139(Invalid memory reference))
What's this error about? and Is the program in textbook wrong?