Great question Khaipi! :-) In programming, deciding where to put the brackets is something that people often call a "religious war". It's a bit like using tabs or spaces to indent your code in that you can make an argument for one or the other. But ultimately, what is most important is being consistent. This article covers things in more detail: jeremybytes.blogspot.com/2013/04/where-do-curly-braces-belong.html. In my experience both styles are popular, I'm not sure one is much more popular than the other. I've always put my opening backet on a new line because I like how it makes it very clear that a "new block" is starting, and it puts some blank space between the code and function prototype for readability. You lose some vertical space this way, but modern computers have larger high resolution monitors that can display many lines of code at once (not as true 30-40 years ago).
I really glad to learn these kind of informations as a embedded software engineer. Thank you!
This is cool. Great explanation 🌹
Thank you, I’m glad you enjoyed it! :-)
why do you have the { below the function?
for example:
int main()
{
}
where as most people do
int main(){
}
Great question Khaipi! :-) In programming, deciding where to put the brackets is something that people often call a "religious war". It's a bit like using tabs or spaces to indent your code in that you can make an argument for one or the other. But ultimately, what is most important is being consistent. This article covers things in more detail: jeremybytes.blogspot.com/2013/04/where-do-curly-braces-belong.html. In my experience both styles are popular, I'm not sure one is much more popular than the other. I've always put my opening backet on a new line because I like how it makes it very clear that a "new block" is starting, and it puts some blank space between the code and function prototype for readability. You lose some vertical space this way, but modern computers have larger high resolution monitors that can display many lines of code at once (not as true 30-40 years ago).
@@PortfolioCourses Thanks man
You’re welcome! :-)
sir , could you explain what is reference(passing) by adresses in functions.
Yes Abdelhak, I actually have a video on that topic here: th-cam.com/video/RecxQUUEOn4/w-d-xo.html. :-)
GG
Thanks Rama! :-)