I am trying to write a simple program that takes in a string, reverses the letters in it and displays the result. I have not got it finished but am stuck as I keep getting this error:
Application Error
The instruction at "0x004010a7" referenced memory at "0x00000065". The memory could not be "read".
this is the code that I have is not much but it is simple and I cannot see the problem. This error only occurs when either of the printf statments are included
[code]
#include <stdio.h>
char *p;
int main(void)
{
char string;
printf("Type in a string: ");
string = getchar();
p=string;
printf("%s\n", string);
printf("%c\n", *p);
}
[code]
I am lost can you help please.



LinkBack URL
About LinkBacks


