What is C?
C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972
It is a prevalent language age, despite being old. Its popularity is mainly because it is a fundamental language in computer science.
C is strongly associated with UNIX, as it was developed to write the UNIX operating system.
Why Learn C?
- It is one of the most popular programming languages in the world
- If you know C, you will have no problem learning other popular programming languages such as Java, Python, C++, C#, etc, as the syntax is similar
- C is very fast, compared to other programming languages, like Java and Python
- C is very versatile; it can be used in both applications and technologies
C Basic Syntax
The basic syntax of the C program consists of the header, main() function, variable declaration, body, and return type of the program.
- The header is the first line in the C program with extension .h which contains macro definitions and C functions.
- Programs must contain the main() function because execution in C programming starts from the main().
- Variable declaration in C is done inside the main function and can be used in the body anywhere but before the main, we can also declare variables which are known as Global variables.
- In the body of the function, we perform operations required inside the function like printing, sum, average, sorting, searching, etc.
- The last part of the C program is the return statement which refers to returning values of the program. If the return type is void then there will be no return statement.
In C programming Semicolon is used to show the termination of Instruction. It is also called a statement terminator since every single statement should end with a semicolon. Semicolons are used to end statements in C.
The Semicolon tells the compiler that the current statement has been terminated. If any statement in the Program ends without a semicolon, then the program will not compile and will generate an error message.
Comments
Post a Comment