+ 1

How to use scanf in c without any error

I was just working with c and just boom. I was blank so please can anyone tell me and give an example too please

10th Feb 2018, 1:36 AM
Kais Momin
Kais Momin - avatar
2 Antworten
+ 3
What error are you getting? a compile error, runtime error, or unexpected result? What code do you have so far? Please post a link so we can help.
10th Feb 2018, 1:56 AM
J.G.
J.G. - avatar
0
If we have an integer variable x, we do this: scanf("%d", &x); Note: remember the format characters for each type. If you want to enter the value of a float or double, use "%f" instead of "%d", and if you want to enter a string, enter "%s". There's more than that, but it should get you started.
10th Feb 2018, 4:15 AM
DaemonThread
DaemonThread - avatar