I am attempting to reverse my lines within a text file using the recursion method. I am pretty stuck right now and my current output is a Segmentation Error- Can someone explain what the segmentation error is from and push me in the right direction?
void RecursionLine();
int main (int argc, char argv)
{
RecursionLine();
printf("\n");
}
void RecursionLine()
{
int c;
if((c = getchar()) != EOF || (c != '\n'))
{
RecursionLine();
printf("%c",c);
}
else if((c = getchar()) != EOF && (c == '\n')){
printf("\n");
RecursionLine();
}
}
Input:
Dogs
Cats
Boys
Output
sgoD
staC
syoB