Skip to player
Skip to main content
Skip to footer
Search
Connect
Watch fullscreen
Like
Bookmark
Share
Add to Playlist
Report
Learn Programming Technique C to Master Skills - About Main function and other syntax
Tutorials Arena
Follow
9/29/2024
Category
š
Learning
Transcript
Display full video transcript
00:00
Hello everyone, today I'm going to explain the syntaxes of the program. I'm going to
00:09
cover those syntaxes which I haven't covered in my previous videos. I will start with main
00:19
and main is a function. Now why we write the codes, why we write the steps of the program
00:28
inside this main function. Why don't we start writing this code, the declaration part and
00:38
then initialization part of the variable and other things directly after the header file.
00:49
Why first of all we use the main function and inside the main function why we write
00:54
down the things. To understand this we have to understand what is function. The meaning
01:03
of function is to execute block of statement or you can say block of statements which perform
01:15
any task and provide result that is known as what function. To better understand I give
01:24
a realistic approach example. Any task which is to be performed that has to be gone through
01:32
steps and when it's gone through steps then that task is performed that function completes
01:43
and in a real life we need an entity to perform that steps. For example suppose one of the
01:54
teacher has to teach any one of the topic of any subject and in the class students are
02:09
there but the teacher is not present. So will the task will perform, will the function operate. No
02:22
you need that entity, the teacher should be there. When the teacher goes through the steps
02:30
to explain about that topic then only the students will be able to understand and if the
02:41
teacher that entity is not there the task is not going to perform because the teacher is going to
02:49
explain the step by step about the subject and then only the task will be performed or you can
03:01
say the function is going to operate and the students are going to understand about the
03:05
topic and if the teacher is absent it's not going to work. So any work which is going to perform,
03:13
any work which is having the steps that is to be execute in a real world for that an
03:21
entity is required. So the same architecture is here also. If these steps are to execute
03:32
for that you need a function and that function is what main. So as in a real life an entity is
03:43
required to go through the steps here the main function is required to go through these steps
03:50
and within this main function these steps are encapsulated which is given to the processor
04:00
to process step by step and the results are obtained. That's why whatever we write, we write
04:09
down inside this main function. Now let us understand about the semicolon which we use
04:20
at the end of the statement. I don't know that have you observe or not. If you see at the end
04:34
of the main function I haven't used semicolon but at the end of the declaration of the variables I
04:43
have used the semicolon and if you see at the end of this for loop statement I haven't used what
04:52
semicolon. So some at the end of some of the statement I have used semicolon but at the end
05:01
of some of the statements I haven't used semicolon. So what the meaning of it? When the explanation
05:12
of any one of this syntax completes within a single line then you have to terminate it and
05:21
you have to tell the compiler that to compile it from the next line. So we have to use what
05:28
semicolon that is the end of the statement or end of the syntax. So here the declaration of
05:36
the variable so meaning of it is completes within a single line that is you have to end this
05:43
statement to add it to acknowledge to the compiler we have to use what semicolon. But main is not a
05:53
single line statement it has to go through steps as we have just discussed that it is a function
06:00
and a function that having the block of statements to perform a task so it has to go through what
06:08
steps and those steps are not in a single line. For that we use what open braces that is start
06:15
of the program. Start of the main function and then close braces that is here at the end that
06:24
is end of the program. So we use what when a statement not ends in a single line we use what
06:42
open braces for the start of the statement and the close braces for the end of the statement.
06:51
So main function is not a single line statement the meaning of it only completes when you go
06:59
through these steps that is of the program. In the same way if you see the for loop so the
07:06
for loop is not going to complete within a single line that's why we haven't used what's
07:11
semicolon at the end of it. So for that is the start of the loop if you see which is
07:20
indicating that loop has started there's some work is performed and when it
07:28
gone through some steps is the end of the loop okay and the same for the if statement you must
07:36
have seen that at the end of this if statement we not use semicolon because it is also not a
07:43
single line statement it's not going to cover in a single line. We need what open braces the true
07:50
part and with the else what the false part or you can say the no part this is the yes part and is
07:56
the no part. So for that when the task is performed through steps more than one steps then we use
08:11
what braces the open braces for the start and close braces for the close. So I explained both
08:19
the things why we use the semicolon and why we use open braces and the close braces. When the
08:28
explanation is in more than one lines in more than one steps for that we use open braces and
08:38
close braces that's why for the start of the function we use open braces for the start of
08:45
the loop we use open braces for the start of the if statement we use open braces and for the end
08:53
of the function we use close braces for the end of the loop use close braces and for the end of
09:00
the if statement also we use what close braces. For the indication of the start and the close of
09:08
function loop and if statement.
09:16
So I hope I have explained all the syntaxes which is used inside the program. I have explained about
09:24
the header files why we use hash include. I have explained in my previous video about the
09:30
header files and the hash include. I have explained about what happens when we declare the
09:37
variables okay and why we use the ampersand sign why the specifiers are used okay and here I have
09:50
used what data type int with the main function it means it should return so it is returning the
10:00
return zero value which indicates the exit status that everything is fine we got the result it is
10:09
indicated by written zero. In the next video I'm going to explain something else. Thanks for today.
Recommended
6:04
|
Up next
Learn Programming Technique C to Master Skills - Structure and Functions
Tutorials Arena
11/10/2024
11:19
Learn Programming Technique C to MasterĀ Skills - What is Function
Tutorials Arena
11/6/2024
10:48
Learn Programming Technique C to Master Skills - Structure and Functions Program
Tutorials Arena
11/10/2024
8:08
Learn Programming Technique C to MasterĀ Skills - First Program of Function
Tutorials Arena
11/3/2024
7:38
Learn Programming Technique C to Master Skills - Recursive Function - I
Tutorials Arena
11/6/2024
8:45
Learn Programming Technique C to MasterĀ Skills - Ninth Program of Function
Tutorials Arena
11/3/2024
11:15
Learn Programming Technique C to MasterĀ Skills - Third Program of Function
Tutorials Arena
11/6/2024
10:48
Learn Programming Technique C to MasterĀ Skills - Eighth Program of Function
Tutorials Arena
11/3/2024
4:51
Learn Programming Technique C to MasterĀ Skills - Seventh Program of Function - I
Tutorials Arena
11/3/2024
5:27
Learn Programming Technique C to MasterĀ Skills - Sixth Program of Function
Tutorials Arena
11/6/2024
7:30
Learn Programming Technique C to MasterĀ Skills - Fifth Program of Function
Tutorials Arena
11/3/2024
3:37
Learn Programming Technique C to Master Skills - Pointers And Arrays
Tutorials Arena
11/8/2024
7:35
Learn Programming Technique C to MasterĀ Skills - Fourth Program of Function
Tutorials Arena
11/3/2024
9:29
Learn.Programming Technique C to Master Skills - Computer Basic & Programming Technique
Tutorials Arena
9/29/2024
8:45
Learn Programming Technique C to Master Skills - Explanation of Pointer - I
Tutorials Arena
11/8/2024
4:22
Learn Programming Technique C to Master Skills - Pointer And Arrays Program
Tutorials Arena
11/9/2024
8:47
Learn Programming Technique C to Master Skills - Structure Pointer
Tutorials Arena
11/30/2024
7:50
Learn Programming Technique C to Master Skills - Use of getchar and putchar functions program
Tutorials Arena
10/12/2024
5:14
Learn Programming Technique C to Master Skills - Single If Statement Program Explanation
Tutorials Arena
10/12/2024
7:20
Learn Programming Technique C to Master Skills - Explanation of First Program of C Language in Code - Blocks
Tutorials Arena
10/8/2024
5:21
Learn.Programming Technique C to Master Skills - Introduction of C Language
Tutorials Arena
9/29/2024
3:16
Learn Programming Technique C to MasterĀ Skills - First Program of Function ( Continue ...)
Tutorials Arena
11/3/2024
4:44
Learn Programming Technique C to MasterĀ Skills - Use of void with Function
Tutorials Arena
11/6/2024
2:41
Learn Programming Technique C to Master Skills - Explanation of First Program of C Language in Flowchart
Tutorials Arena
10/8/2024
12:06
Learn Programming Technique C to Master Skills - Continuous If Statement Program
Tutorials Arena
10/8/2024