I'm programming a text-based adventure game for my C Programming class, but for whatever reason, the code seems to break whenever I try to use "scanf" to get a player's input. Everything will print onto the console perfectly fine, but then when I include the line "scanf("%d", playerInput), nothing will print out and the program will run endlessly. Anyone know why this is the case? Here's my code:
#include <stdbool.h>
#include <stdio.h>
int main()
{
printf("~ Doctor Crowley: Master of Death ~\n"); //Titlecard
//Introductory narration =================================================================================================
printf("\n- Narrator -\n");
printf("You are Doctor Jonathan Crowley, an archeologist and wizard from the Arcane University in Aeternum.\n");
printf("You awaken in your classroom on the first floor of the University. Last you remember, you were in your office\n");
printf("on the sixth floor of the University.\n");
// Player Actions (1) ========================================================================================================================
printf("\n1. Stand up\n");
printf("2. Look around\n");
printf("-------------------------------------------\n");
int playerInput; //player input variable
printf("--> ");
scanf("%d", &playerInput);
return 0;
}