Explanation of value of a variable in c programming language
by examples and questions and answers
Data which any variable keeps is known as value of variable. For example:
int a=5;
Here value of
variable a is five. Name of variable always returns value of the variable.
How to assign
any value to a variable:
C supports
eleven type of assignment operator to assign any value to operator. Those are:
(a) =
(b) +=
(c) -=
(d) v*=
(e) /=
(f) %=
(g) <<=
(h) >>=
(i) |=
(j) &=
(k) ^=
In this chapter
will discuss only first operator i.e. =
Assignment
statement in c:
LValue: Lvalue stands for left value. In
any assignment statement LValue must be a container i.e. which have ability to
hold the data. In c has only one type only container and which is variable.
Hence LValue must be any variable in c it cannot be a constant, function or any
other data type of c. For example
#define <stdio.h>
#define max 125
struct abc{
char *name;
int roll;
};
enum {RED,BLUE};
int main(){
int a;
const b;
a=5;
//10=5; LValue cannot be a integer
constant
//max=20; //Lvalue cannot be a micro
constant
//b=11; Lvalue cannot be a constant
variable
//float=3.3f; Lvalue cannot be a data
type
//abc={“sachin”,5}; Lvalue cannot be a
data type
//BLUE =2; Lvalue cannot be a enum
constant
return 0;
}
RValue: In any assignment
statement RValue must be anything which can return and constant value or it is
itself a constant. RValue can be any c constants, variables, function which is
returning a value etc. For example:
#include<stdio.h>
#define max 5
void display();
float sum();
enum {BLACK, WHITE};
int main(){
int x=2; //RValue can
be a constant.
float y=9.0;
const int z=x; //RValue can
be a constant variable
x=max; //RValue can
be a variable.
x=BLACK; //RValue can be a enum constant.
y=sum();//RValue can be a function.
y=display(); //RValue can
be a function which is
return 0;
}
1 comment:
Finally, you also want to think about|to consider} the materials you work with an everyday basis|regularly|frequently}. CNC spindles are designed to work with all forms of materials, together with embroidery, foam, wood, glass, plastic, and best rated bidet more. Whether your small business offers 3D printing, wood routing, or glass cutting companies, machine spindles can help you streamline your production processes. As with linear interpolation, the control will do its finest to generate a path that's as near that programmed as attainable. The half programmer must decide where the origin of the coordinate axis system ought to be positioned, which is normally based on programming comfort.
Post a Comment