C Programming Write an expression that attempts to read a do

C Programming

Write an expression that attempts to read a double from standard input and store it in an double variable, x, that has already been declared. This expression\'s value should be true if the attempt was successful but false if no data was read because there was no more data available.

must use the EOF constant

Solution

Answer:

Below is the expression that will return true if the value attempt was successful else return false if no data was read.

if(scanf(\"%lf\", &x) != EOF){
printf(\"true\");
}

C Programming Write an expression that attempts to read a double from standard input and store it in an double variable, x, that has already been declared. This

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site