I have just started studying C for the first time and I am encountering many problems. When I write a HelloWorld application using printf everything works a treat, however when I include scanf functions or even a char variable nothing seems to want to work. I understand this may be a silly question, but I would really appreciate any help that's available.
Some of the Errors I have had while trying to compile include:
In function 'main': warning: initialization makes integer from pointer without a cast [enabled by default]
Now, when I try to compile I get no error messages, just nothing is produced or executable at the end. Please help, many thanks.
#include <stdio.h>
int main (void)
{
int Numb;
printf( "Hello world\n");
printf( "I'm Kallum/n");
printf( "Choose a Number Between one and ten: ");
scanf( "%d", &Numb);
printf("This is your Number %d!", Numb);
return 0;
}
The above code will compile and give you the expected output .I am not sure which compiler are you using try with GCC .
Small point please follow some book to understand, before you write the code .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.