This message was supposed to be me asking for help with this program but I found the problem but came up with a question. In the above code I forgot the & sign right after scanf, no big deal just a typo but my compiler didn't catch it yet every time I ran the program it would crash and ask if I wanted to send an error report, can someone elaborate a bit on why it is so important but doesn't show up?Code:#include <stdio.h> int userNum = 0; /*Declare all variables*/ int main() { printf("Please enter a number: \n"); /*Ask for user input and record it to: userNum*/ scanf("%d",userNum); if( userNum = 1) /*Compare userNum to 1 and print corresponding answer*/ printf(" Your number equals 1" ); else printf(" Your number does not equal 1"); return 0; }
P.S. Here is the fixed one:
Code:scanf("%d",userNum);Code:scanf("%d", &userNum);