0

curly brackets in C similar to Python indentations?

I am a beginner to C, i I did only a little bit of Python before. Should I treat the curly brackets { } in C like/similar to indentations in Python? Any feedback would be greatly appreciated, thank you

12th Jan 2022, 6:25 PM
Jermainne Espinoza
2 Réponses
+ 3
If you have only single line statement inside a block then no need of curly brackets. For example:. if (a > b) printf("%d", a); That's enough but for multi line statement you have to use otherwise 2nd line will be considered seperately. if (a > b) { printf("%d", b); printf("%d", a); }
12th Jan 2022, 7:05 PM
A͢J
A͢J - avatar
+ 1
Thank you
12th Jan 2022, 7:10 PM
Jermainne Espinoza