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

What is a stream?
Stream means flow... ofstream This data type represents the output file stream and is used to create files and to write information to files. ifstream This data type represents the input file stream and is used to read information from files
Nilam
How is this site helpful for me? I am looking for a job in the field of Programming in C.
C programming is used mostly for developing drivers, embedded softwares, compilers and more importantly the operating systems themselves for example UNIX OS which is completely written in C language. So...
Umang
What is the output of the below: int x, y; printf("%d", scanf("%d %d", &x, &Y));
:) Good one. It checks my eye sight. This piece of code would result in an error: "undefined symbol Y". Note: 'scanf( )' not only scans and loads the values entered by users into variables, but it...
Pravalika
Who founded the C language? Why?
The C programming language was developed by Dennis Ritchie at Bell Labs in the early 1970s. Ritchie, along with Ken Thompson, created C as an evolution of the B programming language, aiming to enhance...
Santosini
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 Tricky Questions in C
Can you write two functions in which one executes before main function and other executes after the main function? #pragma startup #pragma exit Where, priority is optional integer value.For user priority...

Understanding Computer Science Concepts with Images and Videos..
All Computer science concepts relating to programming and software development are only virtual. It cannot be practically shown as a hardware parts of a computer. But for better understanding it should...

Set 0 To Kth Bit In A Variable
The following code snippet Set 0 to Kth Bit in an variable #include int UnsetBitValue(int n, int k);int main(){ printf("%d\n\n",UnsetBitValue(255,6)); return 0;}// Set kth bit to zeroint UnsetBitValue(int...

Basics Of C And C++
C++ is powerful, highly flexible, and adaptable programming language that allows software engineers to organise and process information quickly and effectively. But this high-level language is relatively...

Why we need to learn Programming languages?
Language is medium for communication. If two parties like to communicate or exchange the thoughts they must know a language. Language should be understandable by both the Parties. For example A wants to...

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