UrbanPro

Learn C Language from the Best Tutors

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

Search in

Other than in a for statement, when is the comma operator used?

Asked by Last Modified  

Follow 1
Answer

Please enter your answer

Software Trainer

Example : int i,j; i=(10,20,30,40); j=10,20,30,40; printf("%d",i); printf("%d",j); // in this program output of i will be 40 and j will be 10 // In interviews you can face such type of comma operator related questions.
Comments

Professional Tutor with 15 years of experience.

Comma operator ( , ) is a binary operator. ------- USE ------- 1. for (first = s, s += len - 1; s >= first; --s) 2. ++p, ++q; 3. int a=1, b=2, c=3; 4. if (y = f(x), y > x) 5. if (failure) return (errno = EINVAL, -1); This can be written more verbosely as: if (failure) { errno =...
read more
Comma operator ( , ) is a binary operator. ------- USE ------- 1. for (first = s, s += len - 1; s >= first; --s) 2. ++p, ++q; 3. int a=1, b=2, c=3; 4. if (y = f(x), y > x) 5. if (failure) return (errno = EINVAL, -1); This can be written more verbosely as: if (failure) { errno = EINVAL; return -1; } 6. printf("Hello, %s!", "world"); 7. printf("Computer","Programming"); 8. void addition(n1,n2,ans); ....etc. read less
Comments

Thanks for the question Sanjay, The comma operator is commonly used to separate variable declarations, function arguments and expressions. Thanks, Team DishaaPro www.dishaapro.com
Comments

While if variables declaratios etc
Comments

Experienced faculty in C with data structures and C++ with Data Structures,Linux Admin with Advance linux concepts

Comma or seperator is used to seperate declarations in the program. Ex: Declaring three integer variables int a,b,c;
Comments

Software Engineer

in printf and scanf like so many is there ex: printf("%d",c); it is used to print the value of c
Comments

International Corporate Trainer For dotnet Core ,Angular 2 ,C ,C++ and LPT Marathi for RBI Banking

comma operatoris used in enum data type declaration enum color={violet,indigo,blue, green}
Comments

Professional Trainer:: Hadoop Big Data, DevOps, Perl, Python

its used only when we use assignment int a=1, b=2, c=3; it has nothing to do with for statement, the assignment which you are doing in for, is where it uses comma.
Comments

It can be used many places, for is not the only place.
Comments

In printf Statement we ll use Comma Operator. Ex: Printf("%d", a); But in for We ll use Semicolon Not comma.
Comments

View 18 more Answers

Related Questions

What is the program for print calendar?
int fm(int date, int month,year) { int fmonth, leap; //leap function 1 for leap & 0 for non-leap if ((year % 100 == 0) && (year % 400 != 0)) leap = 0; else if (year % 4 == 0) ...
Yatindra
Why are there so many programming languages if most programmers use C, C++, Java, and PHP?
This question has the same answer as the question"Why there are so many languages?" has... As they were ask meant for different purpose to serve for different platforms... For short: Link it to the languages used
Veerendra
0 0
7
What is a macro, and how do you use it?
A macro is a fragment of code which has been given a name. Whenever the name is used, it is replaced by the contents of the macro. There are two kinds of macros. They differ mostly in what they look...
Sandeep
What is the use of semicolon at the end of every statement?
Computer languages are just like our normal communication languages. Hindi, eng etc. Enable to communicate us with each other. Similarly computer language helps us to communicate with computer. As a full...
Krishna
Should variables be stored in local blocks?
Variables in local blocks are auto variables, meaning created and removed from memory, automatically.
Sayed

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

Ask a Question

Related Lessons

Storage classes in c
Storage classes determine the scope and life time of a variable. Scope is defined as the region over which the defined variable is accessible. Lifetime is the time during which the value of a variable...

Lets know about far, near and huge pointers for fresher interview purpose
All of these three candidates relate to 16 bit architecture where segmented memory architecture was there. They are not at all relevant for present days 32 or 64 bit architecture where the way of memory...

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...

Static and dynamic libraries
A library is a package of code that is meant to be reused by many programs. A static library (also known as an archive) consists of routines that are compiled and linked directly into your program. When...

4 Things Every Tech Startup Needs to Know About The Coaching Industry
Knowledge on any subject is widely available to those who wish to learn. However, just gathering knowledge from other people doesn’t guarantee results in business. Results come from applying what...

Recommended Articles

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 >

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 >

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 >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

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