+ 12

What is the difference between " = " and " == " ??

10th Jan 2017, 9:27 AM
Himanshu Singh
Himanshu Singh - avatar
43 Antworten
+ 61
= is assignment, like if you wanna assign x as 2, you do int x = 2. == is comparison, if you wanna compare x and 2, you do if (x == 2), either true or false.
10th Jan 2017, 9:30 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 8
"=" is an assignment operator which is used to assign value to the variable ex: int b=7; "==" is a relational operator which is used to find the relation between two operands and returns in boolen value either 'true' or 'false' example: 5==5 Condition true Returns 1 or true
11th Jan 2017, 7:36 PM
Abdullah Sharjil
Abdullah Sharjil - avatar
+ 4
single `=` means you are giving the value example a=2 and == means equal sign with this will returm is true or false example 1==1
12th Jan 2017, 4:46 AM
ARNAB BISWAS
ARNAB BISWAS - avatar
+ 3
"=" is used to assign the value. Example: x = 2, then value of x is 2. "==" is to show equality between values, Example x == y, here the value of y equal to x.
11th Jan 2017, 4:37 PM
N1H4R
N1H4R - avatar
+ 3
= is used for assigning value eg- x=3 y=3 == is used for comparing whether the value is equal eg- if(x==y) comparing whether x is equal to y.
11th Jan 2017, 6:19 PM
Sushil Bajracharya
Sushil Bajracharya - avatar
+ 3
= as in x=2 says give x the value of 2. Then on x's value will be two. This is an assignment operator as ot assigns x a value of two. == as in if(x==2) checks whether x has a value of 2. this is a relational operator as it looks how two things are similar dissimilar of do they fall in the same category like if (x <2).
12th Jan 2017, 5:58 AM
prabin
prabin - avatar
+ 2
first one is assignment operator, and second one is equal operator
10th Jan 2017, 7:28 PM
Nawaj Shareef
Nawaj Shareef - avatar
+ 2
some compilers will warn you, but you need to be careful not to put something like "if (x=5)" since this will return true and assign 5 to x regardless of what x is.
12th Jan 2017, 5:01 AM
Ted Roesch
+ 2
(=) is a Assignment Operators, for assigning a value to a variable. (==) is a Relational Operators, checks the relationship between two operands. Example: x = 10; Now 10 is assign to the variable x. 5 == 10; checks whether the relation is equal or not.
12th Jan 2017, 5:02 AM
Md. Mahfuzur Rahman
Md. Mahfuzur Rahman - avatar
+ 2
= also known as the assignment operator it assigns the value of its right hand side element to the value of its left hand side .I. e if a=b then the value of b is assigned to a on the other hand == is used for the comparison of elements other than string types
17th Jan 2017, 3:49 AM
ANKIT SHARMA
ANKIT SHARMA - avatar
+ 2
= is a assignment operator but == is logical operator
20th Jan 2017, 4:58 AM
Saroj Nayak
Saroj Nayak - avatar
+ 1
= is used to assign value to a variable. the value can be number or alphabet , that depends on the programmer and the program. And == is used to compare the value.
11th Jan 2017, 12:41 PM
Karnajeet Sawant
Karnajeet Sawant - avatar
+ 1
= is nothing but assigning a value for a variable...for example a=5...this means that the value 5 is stored in memory location a...== is a relational operator...... means checks the equality of variables..i.e., checking whether the value belongs to that variable or not...
11th Jan 2017, 2:52 PM
PRIYADHARSHINI G.
PRIYADHARSHINI G. - avatar
+ 1
this is an assignment operator eg. i=5; this is conditional operator eg. if (i==5)
11th Jan 2017, 5:34 PM
Tenny Brown
Tenny Brown - avatar
+ 1
= is known as asssingment operator used for Assing the number to variable while == is used for comparison
11th Jan 2017, 6:00 PM
Mohd Adnan
Mohd Adnan - avatar
+ 1
I think if you need the traditional equality sign that we use in maths, you should use "==", while if you want to set a variable like x to something, use the "=";
11th Jan 2017, 8:05 PM
koki Christopher Titewondze
koki Christopher Titewondze - avatar
+ 1
the = is an assignment statement , the value on the left of it will get a new value that's the result of the right of it. while the == is like asking if the right equals the left; and thus the answer will be yes or no..
11th Jan 2017, 8:28 PM
layth salah
layth salah - avatar
+ 1
The '=' is the assignment operator, which assigns the value at the right hand side to the variable at the left hand side. Eg. x=4, here the value 4 is assigned to 'x'. On the other hand, '==' is the relational operator which is used to check whether the value on both the sides are equal or not. If true, it returns a boolean true or '1' and if false, it returns a boolean false or '0'.
11th Jan 2017, 8:59 PM
Abhi Gaur
Abhi Gaur - avatar
+ 1
"=" mean that we assign value to a variable. Ex x=5 or x=b+1 or a=false "==" mean that we compare two values. Ex a=10 and b=20/2. Thus a==b.
11th Jan 2017, 10:06 PM
Thydaduong Marady
Thydaduong Marady - avatar
+ 1
= for assigning == for if statements
11th Jan 2017, 10:47 PM
John S. Shahla
John S. Shahla - avatar