C- Programming Language :
C is a general-purpose, procedural computer programming language that was developed in the early 1970s by Dennis Ritchie. It is a high-level language, which means that it is easier to read and write compared to low-level languages that are closer to machine code. C is widely used in many fields, including operating systems, computer hardware, and software development.
One of the key features of the C language is its support for a wide range of data types. For example, C supports both primitive data types, such as integers and floating-point numbers, and more complex data types, such as arrays and structures. This makes it a versatile language that can be used to create a wide variety of programs.
Another key feature of C is its support for pointers. Pointers are variables that store the memory address of another variable. This allows C programs to efficiently manipulate data and memory, making it a good language for low-level programming tasks.
To give an example of C programming, consider the following code that calculates the average of three numbers:
#include <stdio.h>
int main()
{
int a = 3;
int b = 7;
int c = 9;
int sum = a + b + c;
int average = sum / 3;
printf(“The average of %d, %d, and %d is %dn”, a, b, c, average);
return 0;
}
This program begins by including the “stdio.h” library, which contains functions for input and output, such as the “printf” function used later in the program.
The “main” function is the entry point for the program, and it is where the program begins execution. Inside the main function, three integer variables are declared and initialized with the values 3, 7, and 9. These values represent the three numbers that we want to calculate the average of.
Next, the program calculates the sum of these three numbers by adding them together and storing the result in the “sum” variable. The program then divides the sum by 3 to calculate the average, and stores the result in the “average” variable.
Finally, the program uses the “printf” function to print the average to the screen. The “printf” function allows us to include placeholders in the output string, indicated by the “%d” characters, which are replaced with the corresponding values when the function is called.
In this example, the output of the program would be:
The average of 3, 7, and 9 is 6
This is a simple example of a C program, but it illustrates some of the key features of the language, such as its support for various data types and its use of pointers to manipulate data and memory. C is a powerful language that is widely used in many fields, and it is an important language for anyone interested in computer programming to learn.