I have a char pointer that holds a single character. I want to create a while loop that will continue to run as long as that character is not '~'. But I cannot seem to get the characters to compare correctly.
char *currChar;
while(currChar != '~') {
//read();
printf("Current Char:%c\n", currChar);
}
read puts the last value entered by the user into currChar. The printF will always output the correct information (i.e. a ~ if the user pressed ~) but for some reason he while loop will never be exited.
If i try to do something like while(*currChar != '~') I get a segmentation fault error.
What can I do to get this to work?
Thanks in advance.