Hey everyone
I wonder why we use // this in C? I know that you say it locks the line but I don't undrestand the concept.Why do we need to do that? &what does it mean?
2 slashes (//) are used for commenting a single line until end. The other comment is /* */. With that you have a problem to comment out the following: if(/*(x==0) &&*/ (y == 0))
if you want to comment out this line you use //: // if(/*(x==0) &&*/ (y == 0))
if you do that with /* */ you'll have a problem because the comment stopps at the first */
/*This cool program prints text
Created by me*/
#include <iostream>
int main()
{
// Place code to destroy the world here.
std::cout << "Hello destroyed world!" << std::endl; // this line prints hello destroyed world to the screen
return 0; // this line does something
}
You can use // to comment the line so you can remember what each line does or to find a specific place later to implement code
What it does, I think, it annotates your source code. Kind of like an explanation to someone else who might get a hold of your work and might want to improve on it or fix errors.
Also it would serve to comment as to why the code was written a certain way or explanation or additional details on the code.
Think a paper with self annotations for future reference.