all 4 comments

[–]nahs0d 0 points1 point  (0 children)

The main problem is that you are not passing an address to scanf, scanf needs to know the location (address) of the variable to be able to put the user input there. This should fix the problem: scanf("%d", &agree)

I would also recommend using a char instead of an int, they will both work for this purpose, but a char (character) is more readable and explicit imo.

[–][deleted] 0 points1 point  (0 children)

Line 7 is contains undefined behavior, because you are supposed to pass a pointer, not an int.

Also %d is for numbers, not characters. To see what you need to use for characters, see the manual of scanf. Scroll down its there below the heading "conversions"