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  

20 Answers

Learn C Language

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

Why is the C program giving the wrong output?
Hi Chandra, Please remember that the program will not give wrong output. The output might be wrong only in the case where there has been incorrect logic used or different output is expected. What is the...
Chandra
0 0
5
Which book is good for C language?
Let Us C by writer-- Yashavant P. Kanetkar (Author)
Rajendra
What is the most efficient way to store flag values?
A flag is a value used to make a decision between two or more options in the execution of a program. Efficiency in this case is a tradeoff between size and speed. The most memory-space efficient way to...
Deepak
0 0
6
How and where do I start learning C programming?
Goals Fundamental concepts of C programming language. Write your first C program. Understand different keywords & Data types in C. Understand Variables & Scope of Variables. Learn Enumeration or Enum...
Krishna
0 0
5
Which language is best, C, C++, Python or Java?
If you want to learn any languages C#, Java, ect. then must to learn C, C++ language as these are base or language to be strong in language skills. C++ is improved version of C language. C#, Java, J# and etc. which are improved version of C++.
Sribaghya
0 0
6

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

Ask a Question

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 >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...

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