C Programming (An Introduction)

Tech Affairs
2 min readApr 30, 2021

C is the general-purpose programming developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories. I will teach you about the c programming language from begging to advanced in this series of posts.

#include<stdio.h>
// This is the Header file for c language

Here stdio is a standard input and output header file which is included using an extension .h. There are many more header files such as conio.h, stdlib.h, maths.h and many more. We will learn about this in further post.

// This is used for the writing comments in c language

// is used for writing the comments.

Main Function

#include<stdio.h>
int main()
{
// Main function goes here.
}

Here, int before the main() is the return type of the main function. We will learn more about the main function in the coming post.

Variables

Variables in C are the container of the value. For example, int contains the integer values(25), float contains the value with decimal(2.5).

#include<stdio.h>
int main()
{
int a = 6; //declaration of variable a
printf("The value of integer a is %d", a);
return 0;
}

Printf and Scanf

In the simple language, the printf is used for printing the values (output), and scanf is used for scanning the values (input).

#include<stdio.h>
int main()
{
int a;
scanf("%d", &a);
printf("The enter value of a is %d", a);
return 0;
}

Points to remember

  1. %d is only used for the integers for others such as float or character we use %f and %c.
  2. /n is used for the new line in the printf statement.
  3. return 0 is used for the return value for the main function.
  4. We can define our own function apart from the main function.

--

--