Curious bug in my program

When running my program at the step

1
2
	printf(" Please enter how many televisions you are buying as: ");
	scanf_s("%d\n", &TV);


It asks for 2 input and then continues through the rest of the program normally, I'm confused as to why.

Any Ideas?
I have a couple of ideas. The first is that you're not using the function correctly. Perhaps you should read the documentation for this "safe" function and use it correctly.

The second is any time you add characters to the scanf(), other than the specifiers, these characters must be input by the user as well. Try getting rid of that end of line character in the specifier string.

Topic archived. No new replies allowed.