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?

Recommended Answers

All 8 Replies

For the entire block of code indeed.

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?

my code here.....

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!

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:

commented: :) +10

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++

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.