+ 2

Bugs in C Lesson Code

Why is there a warning in Dataypes example code? It wasn't there before! See here 👇 Link: https://www.sololearn.com/learn/C/2912/

28th Nov 2019, 2:18 PM
OR!ON 🛡️
OR!ON 🛡️ - avatar
3 Answers
+ 7
In addition to the comments Aaron Eberhardt made, I will add an explanation for what's happening in that lesson: 1) The code is fine, but would be aesthetically pleasing to cast the values to int: (int)sizeof(int). This leads to point 2: 2) The sizeof operator returns a value of type size_t. This is an unsigned integer of at least 16 bits according to the standard, which is why printf complains about the format.
28th Nov 2019, 2:45 PM
Ace
Ace - avatar
+ 3
Sololearn switched to Linux servers several weeks ago. Though they still use the same compiler, the behavior of the output has changed as well. Before the update Sololearn ignored compiler warnings, now all warnings are added to the output.
28th Nov 2019, 2:33 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 1
Thanks 😊 Ace Aaron Eberhardt
28th Nov 2019, 3:30 PM
OR!ON 🛡️
OR!ON 🛡️ - avatar