C Programming Tutorial For Beginners

Delete the entire line of code right so I could delete this code and now I can run my program and it’s no longer gonna print it out it’s no longer gonna do anything but here’s the problem in order to do that I had to actually delete the of code so instead of deleting it I could just bring it back and I could comment it out so.

I could basically surround it with these comment tags and now the computer is just gonna ignore it so it’s not.

Gonna render it because it’s been commented out so now when I run my program it’s gonna do the same thing it won’t execute that line of code but I.

Didn’t have to actually delete the line I could just comment it out so a lot of times.

When you’re writing programs you.

Might want to try to run your program without a certain line or a certain you know series of lines of code and instead of deleting them and then running the program you can just comment them out and see will basically ignore them so that can be really.

The two basic uses for comments and essentially comments are open right it’s just a way that we can write.

Out information in our files that won’t get rendered by C and so you can really use comments to do whatever you want now I will say one best practice with comments is to use them sparingly generally you only want to use a comment when you absolutely have to so we can be really annoying if you open.

Up a C file and there’s like comments littered all around and obviously if you want to put a bunch of comments in your code I mean no one’s stopping you but as a best practice going.

Forward I think generally only using comments when they’re absolutely necessary is kind of like a good practice but again it’s open you know you can use comments for whatever you want in this tutorial I want to talk to you guys about constants in C well constant is a special type of variable and C which can’t be modified so when I create a constant and C I’m.

Basically creating a value that is unable to be modified so I’m gonna show you guys basically how this works out let’s say I created a variable let’s say I created an integer and I just called it num and I set it equal to.

5 right and then I printed out that integer onto the screen so we can print this out percent D and we’re just gonna pranaam right so I can.

Create this num variable I can print.

It out onto the screen let’s say that down here I wanted to modify num so I could basically say num is equal to 8 so I can modify the value that’s stored inside of the num variable and let’s come down.

Here and we’ll print this out as well so d and we’ll print out num again and actually I’m gonna print out a new line here so when I go ahead and run this program and I forgot to send me : when I go ahead and run this program you’ll see we’re printing out five and then we modified the value to eight and then we printed out eight so I.

Was able to modify this value down here I was Mabel to modify num but in certain circumstances and see you’re gonna want to create variables or you’re gonna want to create.