hi there, here is the code in a C book. when I compiled it, it gave me one warning: should return a value for the function. My question: does main() always have to return a value? and how to correct this error. This should be very easy for expert, I think.
// This program asks the user to enter a string and then displays the string
// in reverse.
char * ch_ptr = line;
printf("\Enter a line of characters:\n");
//Find the end of the string
while ( *ch_ptr != '\0' )
//ch_ptr now points to the null chr\aracter
//ch_ptr now pints to the last character in the string
printf("\nThe line in reverse is:\n\n");
//The while loop displays all but the first character
while (ch_ptr != line)
//Display the first character