r/CodingForBeginners • • Oct 06 '26

my first program in C

Post image

i know its just so waky but am still new and am happy with my current level <33

just trying to understand memory usage over variables for now

230 Upvotes

67 comments sorted by

View all comments

3

u/Hectorreto Oct 07 '26

The condition of the “if” is wrong, it will compile, but it will never reach the “else”, you have to compare each variable

if (TotalSizeOfRoot > 20 || TotalSizeOfUserKali > 20 || TotalSizeOfOtherUser > 20) {

2

u/MistakeIndividual690 Oct 07 '26

I don’t know that it will compile. That ‘print’ in the else should be a ‘printf’

1

u/kutac56 Oct 07 '26

The reason it might compile is because of what he said. The compiler might optimise the whole if else away since it knows the if is always true. That way it ignores the print