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

any one can teach me c++
Yes of course i can give you online classes
Bhuvanesh
Is C programming necessary to learn to become a software engineer?
C language is starting language for programming, if you will understand the concept of C language then it would be very easy to learn all programming language because somehow concepts are similar
Ujwalajagdale
0 0
7
What is the difference between #include< > and #include" "
first one is used for predefined header files.. and second is used for user defined header files
Priya
1 0
6
How to improve my c knowledge........
First learn the basic concepts of C .There is a book named Let Us C. It is a very good book with all the basics and concepts of C.I also have this book .I take classes of teaching basics of C,C++,java. Learn...
Anish
How can I develop my C language?
Developing your proficiency in the C programming language involves a combination of learning, practice, and real-world application. Here are some steps to help you enhance your skills in C: Learn the...
Himanshu
0 0
5

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

Ask a Question

Related Lessons

Be prepared to get trained--init
Before starting the training,students must be mentally prepared for acceptance of new knowledge. Students must attend training with open minded forgetting the position they are working.This will help...
S

Smartnub Softsolutions

0 0
0

C, Cpp, Java, Python, Javascript Programming Languages
Learning C is as good as Learning a Natural Language(such as English, Hindi, Telugu, Tamil etc) We use Natural Languages to communicate with humans whereas we use Programming Languages such as C, Cpp,...
V

Vamshi

0 0
0

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

C Program-String Comparison
// WAP to compare strings entered by the user //Header files #include<stdio.h>#include<conio.h>#include<string.h> //Main function void main(){ char str1; char str2; int comp; //Function...
S

Operators in C
Operators in C Operator: An operator is a symbol that tells the compiler to perform certain mathematical or logical calculations. Operators are used in programs to manipulate data and variables. The...

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