Should be:
scanf("%d", &userChoice);
Need the ampersand to read it into the location of userChoice, and not the value of userChoice.
More Related Contents:
- Assembly code fsqrt and fmul instructions
- Running C — helloWorld runs but nothing else — Ubuntu
- Why does the order of ‘-l’ option in gcc matter? [duplicate]
- Hide password input on terminal
- Trying to understand gcc option -fomit-frame-pointer
- How can I use “sizeof” in a preprocessor macro?
- difference between %ms and %s scanf
- How do I print uint32_t and uint16_t variables’ value?
- gcc will not properly include math.h
- How to print the address of a function?
- `bash: ./a.out: No such file or directory` on running executable produced by `ld`
- Linking against older symbol version in a .so file
- What does -D_XOPEN_SOURCE do/mean?
- strict aliasing in C
- Can I make gcc tell me when a calculation results in NaN or inf at runtime?
- why does GCC __builtin_prefetch not improve performance?
- Does pthread_mutex_lock contains memory fence instruction? [duplicate]
- what “inline __attribute__((always_inline))” means in the function?
- The difference between asm, asm volatile and clobbering memory
- Is there a way to get warned about unused functions?
- Getting started with Intel x86 SSE SIMD instructions
- Compare 16 byte strings with SSE
- How to tell GCC to generate 16-bit code for real mode
- How to get the size of a C function from inside a C program or with inline assembly?
- Why is execstack required to execute code on the heap?
- gcc detect duplicate symbols/functions in static libraries
- GCC – no warning about an uninitialized array with -O0
- Order of fields when using a bit field in C
- How much overhead can the -fPIC flag add?
- conflicting types error when compiling c program using gcc