Use of comma operator in C and C++ - Syntax and Example

<<Previous

Next >>





Comma operator is used to separate 2 or more variables or expressions. It has the lowest priority among all other operators.

Comma Operator in C and C++ - Syntax


For example:
     a=17, b=28, c=a+b;

Comma Operator in C Example

#include <stdio.h>
#include <conio.h>

int main()
{
  printf("The Addition :%d\n The Subtraction : %d \n",(2+5),(5-4));
  return(0);

}

Output

The addition : 7
The Subtraction : 1

<< Previous

Next >>




strcat() - String Concatenation        strcmp() - String Compare


strcpy() - String Copy        strlen() - String Length














Use of comma operator in C and C++ - Syntax and Example

<<Previous

Next >>





Comma operator is used to separate 2 or more variables or expressions. It has the lowest priority among all other operators.

Comma Operator in C and C++ - Syntax


For example:
     a=17, b=28, c=a+b;

Comma Operator in C Example

#include <stdio.h>
#include <conio.h>

int main()
{
  printf("The Addition :%d\n The Subtraction : %d \n",(2+5),(5-4));
  return(0);

}

Output

The addition : 7
The Subtraction : 1

<< Previous

Next >>






strncat() - String n Concatenation        strlwr() - String Lower       

strncmp() - String n Compare       strncpy() - String n Copy