Introduction to C:


C is a powerful, general-purpose programming language that was developed in the early 1970s by Dennis Ritchie at Bell Labs. It's known for its efficiency, flexibility, and portability, making it widely used across various applications.


The Simplest Hello Words program in C can be written as:



  • Including <stdio.h> library is necessary to access standard input output functions like printf() and scanf().
  • main() is a compulsory function in C
  • /*.....*/ is a comment which won't be shown on the terminal

List of most used header files in C:


Header files in C play a pivotal role in modular programming by providing a way to declare and define functions, structures, and other constructs that can be shared across multiple source files in a program.



Library functions:

 

scanf() and printf()

 

scanf() is used to accept values at the terminal from the user and printf() is used to display values at the terminal

 

 

Certain format specifiers are used while accepting and printing values like:


%d or %i -- For integers

%f -- For float values

%c -- For character values

%s -- For strings



Example:

To accept an age, marks, division and name of a student we'd write :

 

int age;                             //declaration

float mks;                        //declaration

char div;                          //declaration

char name[50];               //declaration

printf("Enter age, marks, division and name\n")

scanf(" %d %f %c %s ", &age , &mks , &div , &name );


Here the access specifiers allow us to get the respective inputs