Variable in c in hindi language

Variable in c in Hindi: Aaj ke is tutorial me hum c programming me variables ke bare me padhenge. or yeh samjenge ki variable kya hota hai or program me variable ko kaise or kyu use Kiya jata hai.

Variable in c in hindi
variable

Variable in c in Hindi

Variable

Variable ek Aisa name hota hai jo ki program me kisi memory ki location ko present Karta hai. or is variable ki madad se hum ush memory location par hum koi value store karva skte hai or chahe to ushe program me bhi use or modify kar skte hai.

Ek variable ko program me use karne se pahle use declare karna padta hai.


How to declare a variable

Syntax:
type <variable_name or variable_list>;
Example
int a;
int a, b, c;
Note: Abhi tak aapne data type ke bare me nahi pada hai to ish post ko jarur padhe. nahi to aapko variable ke declaration ke bare me kuch samaj me nahi aayega.


Types of variables:

C me variables ke kai types hote hai.
  • integer variable
  • unsigned integer variable
  • long integer variable
  • short integer variable
  • float variable
  • double float variable
  • character variable

Note: jab aap data types ke bare me padhenge tab aapko variables ke types ke bare me pata chal gayega.

How to define the variable name


c me variable ke name ko define karne ke liye kuch conditions hoti hai. jo ki aapko follow Karni padti hai variable ke kisi bhi name ko declare karne ke liye.

Ek variable name ka first character hamesa ya to letter hona chahiye ya fir underscore ho skta hai.

Example
int num
int _num
Note: upar defined variable num ka pehla word ek letter hai. or second, define variable ka first-word _ underscore hai. is liye yeh ek valid variable name hai.

Ek variable ke name me character sequence me letter, digits or underscore hi ho skte hai.

Example
int n1um
int n_um
Note: upar defined variable me character or sequence letter, digits or underscore hai. is liye yeh ek valid variable name hai.

Ek variable ka name keyword nahi ho skta hai.

Example
int switch
int float
Note: upar defined variable ke name c me define keywords hai. jaise ki switch or float ek keyword hai. is liye yeh ek valid variable name nahi hai.

Variable access

c me access ke tor par variables 2 parkar ke hote hai.
  • Local variable
  • Global variable


Local variable

local variable vo variable hote hai. jinko hum function ke andar define karte hai or jinko hum function ke bahar access nahi kar skte hai.

Note: function ke bare me hum aage ke tutorials me brief me padhenge.


Global variable

global variable vo variable hote hai. jinko hum main function ke bahar defined karte hai. or jinko hum kahi se bhi access kar skte hai.

Example
#include <stdio.h>
#include <conio.h>
int a=20; //global variable
void main( )
{
  int a=30; //local variable
  printf("this is local variable: a = %d", a);
 add();
getch();
}


void add( )
{
  printf("this is a global variable: a=%d, a);}
Output
this is a local variable a= 30
this is a global variable a=20

please do like share this post as much as possible and also do comment me your questions.

Post a Comment

0 Comments