Introduction to 'C' Language:
- 'C' is a programming language used to write the programs and execute them.
- 'C' Language is Known as middle level language
- 'C' Programming language developed at AT&T's Bell Laboratories in USA in 1972. It was written by Dennis Ritchie.
- It is necessary to learn 'C' before learning C++, java, C#, etc
- 'C' language uses compiler. There are so many compiler available for 'C' e.g Borlands Compiler,etc.
- Compiler is a translator which used to convert high level language into binary (0's & 1's) language.
Hello World!
As when learning any new language, the place to start is with the classic "Hello world!" programming.
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}
Let's break down the code the code to understand each line:
#include <stdio.h> The function used for generating output is defined in stdio.h in order to used the printf function, we need to first include the required file, also called a header file.
int main() The main() function is the entry point to a program. Curly brackets {} indicate the beginning and end of a function (also called a code block). The statement inside the brackets determine what the function does when executed.
The printf function is usedd to generate ouput:
Here, we pass the text "Hello world!" to it.
The \n escape sequence output a newline character. Escape sequences always begin with a backslash "\". The semicolon; indicates the end of the statement. Each statement must end with a semicolon.
return 0; This statement terminates the main() function and return the value 0 to the calling process. The number 0 generally means that our program has successfully executed. any other number indicates that the program has faild.
Take a QUAIZ
0 Comments