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

Program to accept a list of elements and find the maximum number in the list. 

 

The logic will be 1. Create an array of the desired type 2. Sort the array in the descending order 3. Fetch the first elemnet from the array, this will be the maximum element in that array. Now use...
Lavanya
0 0
8
Why are C and C++ faster than other programming languages?
C is basic programming language. It is very simple language & interested. C is procedural programming language
Kalyani
0 0
8
Where is C used today?
C programming language is still widely used today in various domains. Here are some areas where C remains prevalent: System Programming: C is extensively used for developing operating systems and...
S
0 0
6
What is C language?
it is a computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations
Uday
Which is the best book for understanding concepts of c language?
There are several good books for learning C programming. Here are a few highly recommended ones: "C Programming Absolute Beginner's Guide" by Perry and Miller: A great choice for absolute beginners,...
Chetana
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

Some interview questions for freshers on C language
Q1. What are the two forms of #include? There are two variants of #include. The one is #include and the other one is #include”file”. In general the first form that is #include is used to...

What Would Be Life Cycle Of A Fresher After Campus In An IT Company?
1. Basic Technical Training: Since freshers are not subject matter experts so gone through 3 - 6 months basic technical training within Organization. 2. Technical Assessment: HR sends freshers to various...


What is a Programming Language
What is a Language? Language is a communication system of human. What is a programming Language? A programming Language is a formal constructed language design to communicate...

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