:: 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 (91)
 OOPS interview questions  OOPS Interview Questions (558)
 C++ General interview questions  C++ General Interview Questions (458)
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 ?    54 Yes 3 No
Anita Sachdeva
# 2
== --->comparision
Is This Answer Correct ?    40 Yes 4 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 ?    25 Yes 3 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 ?    12 Yes 2 No
# 5
= it is used to assign a variable
== it is used to comparison of vale
Is This Answer Correct ?    10 Yes 1 No
# 6
= 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 ?    10 Yes 3 No
K.s. Karthick Prabu
# 7
= 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 ?    8 Yes 1 No
# 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 ?    7 Yes 3 No
Vaibhav Meena
# 9
give the new ans 
Is This Answer Correct ?    4 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
Given a simple program designed to take inputs of integers from 1-1000 and to output the factorial value of that number, how would you test this program? You do not have access to the code. Please be as specific as possible. Microsoft 4
Under what conditions is multiple inheritance not recommended?   1
int f() { int I = 12; int &r = I; r += r / 4; int *p = &r; *p += r; return I; } Referring to the sample code above, what is the return value of the function "f()"? a) 12 b) 15 c) 24 d) 17 e) 30 Quark 2
What is the difference between reference type and pointers. HCL 4
show that among any group of five (not necessary consecutive ) integers, there are two with the same remainder when divided by 4.   1
write a program in c++ to implement stack using functions in header file stack.h Subex 3
Find out the bug in this code,because of that this code will not compile....... #include <iostream> #include <new> #include <cstring> using namespace std; class balance { double cur_bal; char name[80]; public: balance(double n, char *s) { cur_bal = n; strcpy(name, s); } ~balance() { cout << "Destructing "; cout << name << "\n"; } void set(double n, char *s) { cur_bal = n; strcpy(name, s); } void get_bal(double &n, char *s) { n = cur_bal; strcpy(s, name); } }; int main() { balance *p; char s[80]; double n; int i; try { p = new balance [3]; // allocate entire array } catch (bad_alloc xa) { cout << "Allocation Failure\n"; return 1; } Impetus 2
Write any small program that will compile in "C" but not in "C++"?   4
tell me about yourself ?i want answer for frehers with various exasmples? HCL 2
Can inline functions have a recursion? Give the reason?   2
What are advantages of C++ when comparing with C? HP 18
what is the basic concept of c++(object oriented programing) Wipro 4
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.   ::