Introduction to C language.
C language is general purpose, procedural programming language supporting structured programming.
C language was originally developed at “Bell Labs” by Dennis Richie between 1972 ad 1973 to make utilities running on UNIX operating system. later it was applied to re-implementing the kernel of the UNIX operating systems.
Lets move towards the important portion of C language.The body of C language.
The structure of C program consists.
1. Header Files.
Header files are files with extension “.C” which contains c functions declarations and micro definitions to be shared between different source files. There are two types of header file:
a) Files comes with compiler.
b) Files developer writes.
some pre defined user files are:
2. main() functions()
There are two types of function in c programming.
- user defined function.
- standard library function.
User defined functions:
A function is block of code that performs a specific task. C allows you to define functions according to our need and purpose. These functions are known as user defined functions.
Standard library functions:
standard library functions are built in functions in C language.
let us consider printf() function it is pre-defined function defined in header files itself. printf() function is use to send formatted output to the console screen. this function is defined in the stdio.h header file.
Also scanf() function is pre defined function in C programming. It reads the data from the user fro processing this function is also defined in stdio.h
In C programming, variables which are to be used in different portions of C program. The variable declaration tells compiler two things: The name of variable and The type of data variable will hold.
for ex: datatype_(variable),
The Body contains the logic of the C program. It refers to the operation that are performed in the functions. It can be anything like manipulations, searching, sorting, printing,etc.
for ex: the logic for bubble sort is stepping through array elements and
comparing the adjacent element.
let us organize the array elements in ascending order.
after running two loops we read the data elements and compare them
with adjacent left element if it is bigger then swapping happens.
temp = array[j];
array[j] = array[j+1];
array[j+1] = temp;
this is swapping logic behind the bubble sort.
The return statement is use to terminate the execution of the function and transfer the program control back to the calling function it can be said as it returns the result.using the syntax return program is put to an end.