UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What is the difference between n=1 and n==1 in the C language?

Asked by Last Modified  

Follow 11
Answer

Please enter your answer

Computer Trainer: Programming & Software Development.

'=' is ASSIGNMENT operator , where as '==' is COMPARISON operator. int a=7; assigns the variable a an integer value 7 , where as a==7; checks if the VALUE of a is EQUAL to 7.
Comments

Trainer

'=' is used to initialized value to a variable (ASSIGNMENT operator ) '==' is relational operator which is used to compare with two variables in If condition statements example n=1; in this statements 1 will be assign to variable n next , n==1; here it will check ...is n equal to 1 or not ; if...
read more

'=' is used to initialized value to a variable  (ASSIGNMENT operator  )

'==' is relational operator which is used to compare with two variables  in If condition statements

example n=1; in this statements 1 will be assign to variable n

next , n==1;

here it will check ...is n equal to  1 or not  ;

if it is equal it will return true value or it will execut if statement

if(n==1) // it is true so it executs statement

{

statement;

thank u

 

read less
Comments

Experienced & certified IT Professional Trainer empowering students to reach their potential.

'=' is the most commonly used assignment operator. An assignment operator is used for assigning a value to a variable. So n=1 means variable n is assigned with value 1. whereas '==' means an equal to operator which is a relational operator. A relational operator checks the relationship between two...
read more

'=' is the most commonly used assignment operator. An assignment operator is used for assigning a value to a variable.

So n=1 means variable n is assigned with value 1.

 

whereas '==' means an equal to operator which is a relational operator. A relational operator checks the relationship between two operands. If the relation is true, it returns 1; if the relation is false, it returns value 0. Relational operators are used in decision making and loops.

So n==1 means it's checked whether the variable n holds the value 1.

read less
Comments

In c n==1 is correct coding n=1 is not correct
Comments

1. n=1 means assigning 1 to n. 2. n==1 means comparing n with 1. Eg: if(n==1) n value is 1 condition is true and if condition is also true condition will execute i.e output is 1. n value is other than 1 if conidition is false condition will not work. i.e. output is 0.
read more

1. n=1 means  assigning 1 to n.

2. n==1 means  comparing n with 1.

    Eg: if(n==1)

n value is 1 condition is true and if condition is also true condition will execute i.e output is 1.

n value is other than 1 if conidition is false condition will not work. i.e. output is 0.

read less
Comments

Computer Science Tutor

= and == both are operators in c. The = sign is known as assignment operator wehreas == is known as logical operator. The assingment operator is used to assign a vaule (or varibale) to a variable. For example, n=1 (or n=a). This means that the vaule of n is 1. The == operator is used for logical opearation....
read more

= and ==  both are operators in c. The = sign is known as assignment operator wehreas == is known as  logical operator.

The assingment operator is used to assign a vaule (or varibale) to a variable. For example, n=1 (or n=a). This means that the vaule of n is 1.

The == operator is used for logical opearation. For example if(n==1), that is the value of n is compared to 1, if it is true i.e n is equal to 1, then true statements are executed else false statements are executed.

read less
Comments

yes! As my tutor Shri Badri Gopi Krishna sir said, = operator is used to assigne a value to a variable. By using it a value will be stored in the memory of a variable, and == operator is used to compire a value with another i.e. compire L (Left side) value with R (Right side) value. We can also check...
read more

yes!

As my tutor Shri Badri Gopi Krishna sir said, =  operator is used to assigne a value to a variable. By using it a value will be stored in the memory of a variable, and == operator is used to compire a value with another i.e. compire L (Left side) value with R (Right side) value. We can also check the values stored in two variables are equal or not like (a=b=1;) to check is both a and b has same value or not we can use ( a==b  ) if both are equal value it returns True else False we can use this == operator morly with IF condition 

read less
Comments

Computer classes For Working professionals and studne of Engineering, MCA, Class 12,11 class 10

n=1 means. you are assigning value 1 to n. value 1 is stored in variable n. = is an assignment operator where as n==1 means you are checking for equality. It checks whether value of n equls to 1. == is relational operator
Comments

View 6 more Answers

Related Questions

Can include files be nested?
one line can only include one directory. No nesting is applicable.
Himangi
0 0
7
What is #line used for?
# is a preprocessor directive. so it is used in the c program by two way. 1. such as #include stdio.h In this line to read all the library function of stdio.h before processing the program. 2. # define...
Pradeep
Are C Programmers currently in demand?
Ofcourse, C is alwasy in demand. In the beginning a lot of the big project developed in C language. Now a days, there are a lot of language in market and speciallity is growing in IT field. For a big organization...
Harsha
What is the cost of the course?What kind of questions are asked for interviews from C language??
Course fee depends on the depth of the course. Interview question are mainly from DS(Data Structure) importantly linked list, BST tree,array and except this pointer, string, function and recursion is important.
Chandana
What is C language?
C is a general-purpose, procedural programming language that was developed in the early 1970s by Dennis Ritchie at Bell Labs. It is a low-level language, which means it provides a relatively simple and...
Vikram
0 0
7

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Pointers and References
Are reference and pointers same? No. I have seen this confusion crumbling up among the student from the first day. So better clear out this confusion at thevery beginning. Pointers and reference...

Why C is a Language and not a database?
When I interviewed a candidate, I raised this question many times, but I have not got the answer correctly. To under why C is a language and not a database, it is good to understand why our communication...

Compiler vs Interpreter
Compiler Interpreter Convert all the code into binary format and execute. Convert one statement at a time and execute, then Convert next statement and execute. After conversion, source...

All About Programming And A Good Programmer.
Hi, This is my first lesson for you guys. Hope you enjoy reading it. In recent community questions, I found many people wanted to be good programmers, or wanted to have good hands on certain language,...

Features Of C Language
Features of C language It is a robust language with rich set of built-in functions and operators that can be used to write any complex program. The C compiler combines the capabilities of an assembly...

Recommended Articles

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Hadoop is a framework which has been developed for organizing and analysing big chunks of data for a business. Suppose you have a file larger than your system’s storage capacity and you can’t store it. Hadoop helps in storing bigger files than what could be stored on one particular server. You can therefore store very,...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more