Lesson 2 Learn Computer Science: Structure of C language, Comments & how to write comments? Grade10
Автор: Taleem Manzil
Загружено: 2025-05-11
Просмотров: 65
Описание:
Lesson 2 Learn Computer Science: Structure of C language, Comments & how to write comments? Grade10
In this lesson we have explained all about C language.
Structure of C language, Header or linked section
Main Section
Body of main function
Important notes to be remembered in programming
Comments in C language
Structure of C language
1. Link Section or Header
The programmer uses many functions while writing a program in C language. These functions are defined in a C language. The programmer has to place all of these defined functions in files. These files are called linked file or Header files.
The programmer includes these files in the program by writing the include statements at the top of the program.
2. Main section
Main section consists of main() function. Every C program must contain main () function. Main function is the starting point of execution
3. Body of main function
The body of the main () is enclosed in the curly braces {}
All the statements inside of these curly braces make the body of the main function. The statement printf (“Hello world!”); uses predefined function printf to display the statement hello world! On the computer screen. We can also create other functions in our program and use them inside the body of main() function.
Important notes to be remembered in programming
The sequence of statements in a C language program should be according to the sequence in which we want our program to be executed
C language is case sensitive. Key words are in small case letter so we cannot capitalize any letter. Here int and Int are very different because int is a keyword but Int is not a keyword.
Each statement in C ends with a semi colon symbol ; symbol.
Comments in C language
Comments are the statements in a program that are ignored by the compiler and do not get executed.
A programmer writes comments in natural language.
Purpose of comments in C language
Purpose of comments are
i. They facilitate other programmers to understand our code.
ii. They help us to understand our own code even after years of writing it.
Types of comments
There are two types of comments
1. Single-line comments
2. Multi-line comments
Single-line comments
Single-line comments consists of a single line
Single-line comments starts with
Anything after // on the same line, is considered a comment. For example, This is a comment.
Multiple-line comments
A comments consists on two or more lines.
Multiple comments start with /* and ends at */
Example of Multiple-lined comment
this is a
multiple–line
Comment
Example of cod
Important notes to be remembered in programming
Comments in C language
This channel is about education, training, history, Pakistan Studies, Education & Training، Science & Technology, Physics & Chemistry, Biology & Life sciences,
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: