I wont talk too much i will paste very simple Code which was written in C.
PROBLEM: Whenever i star this program and type any word which is than stored in STRING it jumps automaticlly to the end of the progam aka the &CHAR does not even get regonized (after this i will burn all books i have bought about all programming languages )
Cheers
#include <stdio.h>
#include <stdlib.h>
int main()
{
char STRING[1000];
char CHAR;
printf("Enter the String:");
scanf("%s",STRING);
printf("Enter the Char:");
scanf("%c",&CHAR);
return 0;
}
I'm assuming that this is happening in some sort of desktop environment, where scanf() is built-in and uses a line-oriented tty driver...
The first scanf() does not actually read the newline at the end of your line , so the second scanf() immediately sees "\n" as the character it reads. printing out CHAR in decimal will show this.
Fix it (probably) by adding the \n to the first scanf: