Hello Everyone
I hope that you all are doing great.
Welcome back to the second lecture of Basic C Language Course.
Today we will doing to learn some new terminologies we use while coding in C language so without wasting any further let me start my lecture.
The very first thing we will going to learn is named as Library
So what is library?
As we all know that library is a place where all the books are kept so whenever we need some information we just go and grab a book similarly in programming Library is a place where all the information about different keywords are stored. So whenever we use some kind of keyword Library helps in finding that what is the function of that keyword or in other words what function users wants from me.
For Example
Their is a Library named as STDIO.H in this library the function of printf is stored that what will going to happen if user types printf somewhere while writing the program or code.
Besides this their is an other keyword scanf the function of scanf is also stored in the same library and because of this library the IDE knows that what i have to do when user writes scanf somewhere.
I hope that the main use of library is clear to all of you.
What is this printf and scanf will do we will see when we will going to write our program.
Now we will going to open the IDE we installed
Double Click on the Icon of IDE. This screen will appear.
Now press Ctrl + N. You will now able to see a cursor on the screen and you can write your code now.
- Now we will going to write our very first line of code which is: #include<stdio.h>. This is how you insert a library in your program.
- After that you will press enter and then you will going to write main(). This means that your program will going to start from here. After that you will again press Enter and insert a pair of curly brackets { }. Press Enter after inserting the brackets.
NOTE: Remember one thing all the code you will going to write between this pair of curly brackets otherwise your it is not possible for the IDE to identify because when you write main() now your IDE know that all it has to do is just go inside the main() and perform what user has asked.
- Now we will going to write our very first line. Above i told you about the keyword printf so the function of this keyword is simple just print what is written between the brackets of this keyword. You can print whatever you want to.
The Syntax for using printf is:
First you will write printf then open a round bracket like: printf(.
Now open an inverted comma: printf("
After that write the text you wanted to print.
For Example
printf("Hello Steemit
after that you will close the inverted comma and the round bracket.
printf("Hello Steemit")
Last but not the least a ; (Semi-Colon) in the end of the line so that the IDE knows that here this line is ended by the user.
So the syntax will look like:
printf("Hello Steemit");
After that it is time to see the output what you have to do just simple Press F11 a box will appear just save your program and Boom.
Here is your output screen
Note: In the place of Hello Steemit you can write what ever you want to like i am going to print my name
For Example
I have written my name now. Lets see how it looks in the output screen.
This is the function of printf
I am pasting these sample codes if you wanted to try just copy paste them and try to print different things as well.
Program To Print "Hello Steemit"
#include<stdio.h>
main()
{
printf("Hello Steemit");
}
Program To Print Your Name
#include<stdio.h>
main()
{
printf("My Name Is Abdullah Bin Tahir");
}
That is al for today i hope you guys like it.
Will see you all in the next Lecture In Sha Allah with some more interesting work. Till than Allah Hafiz.
50 SP | 100 SP | 200 SP | 300 SP | 400 SP | 500 SP |
---|
1000 SP | 1500 SP | 2000 SP | 3000 SP | 4000 SP | 5000 SP |
---|
If you are reading this till the end lots of love and well wishes for you
Have A Nice Day
KNOW MORE ABOUT ME HERE
Regards
@abdullah.tahir
Nice post bro.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit