What is the difference between = and == in C?
Answer Posted / swapna
= is used for assigning the value to a variable
for example
int a=10;
if a=5
printf("%d",a);
else
printf("%d",a);
output:5
in this program a value is assigned to 5 and 5 is printed.
whereas
== is used to check the value of the variable
for example
int a=10;
if a==5
printf("%d",++a);
else
printf("%d",a);
output:10
in this value of a is checked with 10 .If it is equal if
stmt is true and a is incrementd and printed.
If it is not equal a value is printed.
| Is This Answer Correct ? | 14 Yes | 0 No |
Post New Answer View All Answers
What is the function of enhancement mode transistor?
What is Noise Margin? Explain the procedure to determine Noise Margin?
How does Vbe and Ic change with temperature?
What are the steps required to solve setup and hold violations in vlsi?
In a SRAM layout, which metal layers would you prefer for Word Lines and Bit Lines? Why?
Give a big picture of the entire SRAM Layout showing your placements of SRAM Cells, Row Decoders, Column Decoders, Read Circuit, Write Circuit and Buffers
Give the cross-sectional diagram of the cmos.
Explain Basic Stuff related to Perl?
Cross section of a PMOS transistor?
How can you model a SRAM at RTL Level?
How logical gates are controlled by boolean logic?
Draw a transistor level two input NAND gate. Explain its sizing (a) considering Vth (b) for equal rise and fall times
Explain how MOSFET works?
Explain how binary number can give a signal or convert into a digital signal?
Are you familiar with the term snooping?