Assigning Values to Variables in C Language

In the previous post, we learnt a variable declaration. In this post, we will understand the syntax assigning values to variables

It is very easy to understand. If you don’t know how to declare a new variable please click on below link.

Let’s understand Assigning Values to Variables

#include<stdio.h>
#include<conio.h>

void main()
{

int a,b,c; //variable declaraction
float salary; //variable declaraction
clrscr();

a=5; //variable initilization
printf("Enter value of b");
scanf("%d",&a); //variable initilization

c=a+10; //variable initilization

salary=5005.50; //variable initilization

getch();
}

In the above program code, you can see that the first 2 lines are used to declare a few variables.

After declaring, you can assign values on those variables as per requirement. You can use scanf() function to input values from a user or you can assign values using equal to operator.

You can also read

Hope that you understand the concept of assigning values to variables in C Language. If you have any questions please ask me in below comment section.

Don’t forget to share this post in your social family.

Leave a Comment

error: Don\'t make piracy - Write your own content :)