What is C Language?
C is a high-level programming language originally developed by Dennis Ritchie at Bell Labs in the early 1970s. It is a procedural, imperative, and general-purpose programming language. C is widely used for system programming, developing operating systems, embedded systems, and application software
C is general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC PDP-11 computer in 1992.
Facts About C
- C was invented to write an operating system called UNIX.
- C is a successor of B language which was introduced around the early 1970s.
- The was formalized in 1988 by the American National Standard Institute (ANSI). The UNIX OS was totally written in C.
- Today C is the most widely used and popular System Programming Language.
- Most of the state-of-the-art software have been implemented using C.
- Today's most popular Linux OS and RDBMS MySQL have been written in C.
Structure of C program
The Structure of C program is as follow:
Header #include<stdio.h>
main() int main()
{
Variable declaration int a = 10;
Body printf("%d", a);
Return return 0;
}
1. The Component of the above structure are:
1. Header Files Inclusion : The first and foremost component is the inclusion of the Header files in a C Program.
A header file is a file with extension .h which contains C declarations and macro definitions to be shared between several source file.
Some of C Header file:
- stddef.h - Defines several useful types and macros.
- stdint.h - Defines exact width integer types.
- stdio.g - Defines core input and output functions.
- stdlib.h - Defines numeric conversion functions, pseudo-random network generator, memory allocation.
- string.h - Defines string handling functions.
- math.h - Defines common mathematical functions.
2. Main Method Declaration : The next part of a C program is to declare the mains() function.
Syntax to Declare the main method :
1.
int main() {
}
2. Variable Declaration : The next part of any C program is the variable declaration. It refers to the variables that are to be used in the function.
Example
int main() {
int a;
}
3. Body : The body of a function in the C program, refers to the operations that are performed in the functions. It can be anything like manipulations, searching, sorting, printing, etc.
Example:
int main() {
int a;
printf("%d", a);
}
4. Return Statement: The last part of any C program is the return statement. The return statement refers to the returning of the values from a function. This return statement and return value depend upon the return type of the function. For example, if the return value depend upon the return type of the function.
Example:
int main() {
int a;
printf("%d", a);
return 0;
}
Writing and executing first C Program
following is first program in C
#include<stdio.h>
int main() {
printf("Hello World");
return 0;
}
Thankyou so much all of you for visiting. If this coneten is helpful for you, then share it with your friends also by using facebook, tweeter, instagram and other social media paltform.