:: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Categories >> Software >> Programming Languages >> C++ >> C++ General


 STL interview questions  STL Interview Questions (93)
 OOPS interview questions  OOPS Interview Questions (563)
 C++ General interview questions  C++ General Interview Questions (461)
What is the difference between = and == in C?
 Question Submitted By :: C++-General
I also faced this Question!!     Answer Posted By  
# 1
= operator in C language is used to assign the value of
right-hand side value/variable/expression to the left hand
side variable.

== operator in C/C++ language is used to check the value of
left hand variable/expression with the right hand
variable/expression. whether the two values are equal or
not. It returns true if these are equal else it will return
Is This Answer Correct ?    69 Yes 5 No
Anita Sachdeva
# 2
== --->comparision
Is This Answer Correct ?    48 Yes 7 No
# 3
1. First of all = is a assignment operator and == is a
comparision operator
2.= give you the same vale like x=y means if x=5 then y=5
on the otehr hand if x==y then it will give you the true or
eg if x==5
then return true
Is This Answer Correct ?    29 Yes 5 No
# 4
= Assignment Operator
== Comparision Operator

One Intresting Difference between these two is in the =
operator the left side can not be a const, while in == we
can place Const in either side.
eg. x = 5 //correct
5 = x // Incorrect

but X == 5 // CORRECT
5 == X // Correct and Preffered to use left value
as constant to avoid the unwanted bug.
Is This Answer Correct ?    16 Yes 2 No
# 5
= it is used to assign a variable
== it is used to comparison of vale
Is This Answer Correct ?    12 Yes 1 No
# 6
= is used to assign the values to the variables.

Eg:- int a=5,b;

== is used for comparison purpose.

Eg:- if(a==b)
Is This Answer Correct ?    10 Yes 1 No
# 7
= is the assigment operator

=is used to copy
a=5 means, copy just that value for 'a'.
== is comparision operator

void main()
int a;
printf("if the is not equal to 5");
Is This Answer Correct ?    11 Yes 4 No
K.s. Karthick Prabu
# 8
= is assignment operator. It is used to assigne a value to a
and == is a comparison operator is is used to compare to values.
Is This Answer Correct ?    8 Yes 3 No
Vaibhav Meena
# 9
give the new ans 
Is This Answer Correct ?    7 Yes 3 No
# 10
= this is assignment is used to assign a
variable to variable and assign a value to variable.
== this is comparison is used to compare any
two variable and values.
Is This Answer Correct ?    1 Yes 0 No

Other C++ General Interview Questions
  Question Asked @ Answers
What is size of null class? HP 5
Why preincrement operator is faster than postincrement?   5
Adobe Interview & Adobe Placement Paper Adobe 1
If you had the following code: int x = 23; int *y; y = &x; The instruction y++; does what?   2
How to reduce a final size of executable?   3
What is the Difference between "vector" and "array"? TCS 15
What is the difference in size of this two clasees? Class A { int a; char c; float f; } Class B { float f; char c; int a; }   4
What happens if an exception is throws from an object's constructor and from object's destructor? TCS 3
write a program to insert an element into an array TCS 26
diff between pointer and reference in c++?   1
What is the output of: String a1 = "Hello"; String a2 = "world!"; String* s1 = &a2; String& s2 = a1; s1 = &a1; s2 = a2; std::cout << *s1 << " " << s2 << std::endl; Lehman-Brothers 4
int main() { int i ,a[i]; i = 0; a[i] = 10; cout<< a[i] << endl; return 0; } What will be output of this program? Mphasis 11
For more C++ General Interview Questions Click Here 

Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
Copyright 2013  All Rights Reserved.   ::