For a school project, I'm trying to re-create the printf
function of the stdio.h
library in C.
I'm currently working on getting the unsigned int
printing part working, but for some reason, why I try the real printf
to print an unsigned int, it gives me a warning (which is considered as an error in my school). Could you someone explain me why?
Here is the code line I have used: printf("%u\n", 4294967295);
. And here is the error I'm gettting:
main.c:18:17: warning: format specifies type 'unsigned int' but the argument has type 'long' [-Wformat]
printf("%u\n", 4294967295);
~~ ^~~~~~~~~~
%ld
1 warning generated.