[Solved] Why is URI Online always giving me “Presentation Error”

[ad_1]

You misunderstood how printf works. It does not concatenate all the stuff you throw into it like you’re used to from std::cout << … << …; but instead mostly prints the first argument, the format string. The latter arguments only come into play when the format string requests them, as you do with the %0.4f for the second argument. However, the third is unused. You could fix it like this:

printf("A=%0.4f%s", a, "\n");

Or, more idiomatically, like this:

printf("A=%0.4f\n", a);

By the way, at least my gcc warns me:

main.c: In function ‘main’:
main.c:…: warning: too many arguments for format [-Wformat-extra-args]
printf (“A=%0.4f”, a, “\n”);

[ad_2]

solved Why is URI Online always giving me “Presentation Error”