I wonder if anyone can tell me how the code tags works? As per my understanding does it works like:

MY CODE HERE.....

for the enitre block of code? or I need to do this for every line of code?

For the entire block of code indeed.

Then how the text color are applied to the code? I mean which code and what will be the syntax to apply color to the code in the block?

Then how the text color are applied to the code? I mean which code and what will be the syntax to apply color to the code in the block?

It's magic!
Example:

int number = 0;
cout << "hello" << number << '\n';

now the exact same text but in [code]

[/code] tags:

int number = 0;
cout << "hello" << number << '\n';

Voila! Syntax-highlighting!

Why do we use this? Voila! Syntax-highlighting!

"Voila! Syntax-highlighting!" isn't part of the code tag. niek_e is just excited by the power of code tags and decided to spread the enthusiasm. Feel free to replace "Voila! Syntax-highlighting!" with :cool::cool::cool:

Comments
:)

Because it makes the code easier to read? All major IDE's have syntax-highlighting. What IDE/compiler are you using?

Because it makes the code easier to read? All major IDE's have syntax-highlighting. What IDE/compiler are you using?

I am using Dev-C++

This article has been dead for over six months. Start a new discussion instead.