How To Learn Basic C Programming in 30 min?

Latest

How To Learn Basic C Programming in 30 min?

Basic C programming in 30 minute
Basic C programming in 30 minute




Today we will study about How To Learn Basic C Programming in 30 min.

This will be very useful article for you. If yo want to learn basic about c programming then read this article completely.


Table of contents

  • What is C Programming
  • Structure of C Programming
  • Key Word and Identifiers
  • Conclusion


What is C Programming?


C Programming refers to computer programming language. It is a general-purpose programming language. we can also call c programming as a machine language which can be understand and and executed by our computer system.

In General Computer do not understand our human speaking language so we need to communicate with computer system in their own code language. 

Have you ever think about that how any automatic control systems, machines, technical devices or other many electronic, robotic and computer related devices work automatically ?

-Yes, This is because of computer programming. The programmers have been installed c programming code to that device's brain which is called microcontroller/microprocessor. The robot or any devices will work on that specific task whatever the programmers have coded for it. 

STRUCTURE OF C PROGRAMMING.

The basic structure of C programming is given below:

#include<stdio.h> 

#include<conio.h>

void main()

{

//write instructions or code 

getch();

 

Here, "#include" files are library/header files which is necessary for all types of program.

         "void main()" is a main functions, before starting a coding you must need to start with  "void main()" and { bracket to start coding and end with } bracket. 

        getch(); is for holding the result of output screen to display. It is also necessary.

For Example1: 

If you want to print "Hello Manoj How are you?"

#include<stdio.h>

#include<conio.h>

void main()

{

printf("Hello Manoj How are you?");

getch();

}

Here, 

printf is a functional key word to print any thing. you can any thing inside inverted coma "Here you can write anything" that you want to print.

  semicolon ; is necessary at the end of all statement that you are writing inside the void main.

KEY WORD AND IDENTIFEIRS 

Printf- It is used to print your data, word or any thing that you want

Scanf- It is used to take data from input that is from your computer and you have to enter from your keyboard.

int - It is used to define unknown variable to store integer value that you are using in your program. If i want to store 5 in "a" then i will define like: int a or int a=5 

float- It is used to define unknown variable to store floating or decimal value that you are using in your program. If i want to store 5.2 in "b" then i will define like: float b or                 float b=5.2 

%d- It is used to store or print integer numbers of any variables. 

      If i want to store 6 in a then i will write like:

      scanf("%d", &a);

    -And during compiling you have to enter 6 from keyboard.

     Similarly if i want to print 6 that is stored in a then i will write like

     printf("%d", a);

%f- It is similar to %d but only difference is that %f store and print decimal value and you have to replace by %f in the place of  %d 

Now Let's Go to Example2:

If  i want to add two numbers Then program will be like:

#include<stdio.h>

#include<conio.h>

void main()

{

int a, b, sum;

printf("Enter the value of a");

scanf("%d", &a);

printf("Enter the value of b");

scanf("%d", &b);

sum=a+b;

printf("The sum is %d", sum);

getch();

}

Here, Output will be:

  Enter the value of a

    5

Enter the value of b

   6

The sum is

11

Here,

 int a,b,sum; is for difining the variables a, b and sum. Otherwise computer won't recognize them.

Printf is for printing a question to ask the user to enter the value that they want to add.

scanf is for taking and storing the value entered by user.

sum=a+b; is functional keyword to add a and b. If you want to subtract, multiply or divide then you can you such type of signs to perform operations.

Another printf is for display the result of addition. 

%d is used for integer number value. 

CONLUSION

Today we learnt the basic c programming language. After reading this article we will able to do basic coding in c language like printing hello world and performing adding, subtracting and other arithmetic operations very  easily.  

         THANK YOU FOR VISITING AND READING MY SITE. I HOPE YOU WILL LIKE IT.