c - Unintialized local variable, can't find the mistake -


#include <stdlib.h> #include <stdio.h> #pragma warning (disable : 4996) int main() {     double f, c;      printf("enter temperature reading > \n");     scanf("%lf", c);      f = 32 + ( c * (180.0/100.0));      printf("\n temperature reading in fahrenheit : %.1lf", f);      system ("pause") } 

error c4700: uninitialized local variable 'c' used

i can't find mistake in program.

f being set value, in followed = sign, whereas c getting value being passed parameter in function; must set value 0.

secondly scanf("%lf", c) should scanf("%lf", &c)

#include <stdlib.h> #include <stdio.h> #pragma warning (disable : 4996) int main() {     double f, c = 0.0;      printf("enter temperature reading > \n");     scanf("%lf", &c);      f = 32 + ( c * (180.0/100.0));      printf("\n temperature reading in fahrenheit : %.1lf", f);      system ("pause"); } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -