Punctuator in C

A punctuator is also a token and it also defined in compiler like keywords. A punctuator can also be a token that is used in the syntax of the preprocessor. some Operator or punctuator alternative representations for some operators and punctuators.

Punctuator

Operator Meanning
[ ] Array subscript Operator
( ) Parentheses Operator
{ } Braces
= Equal sign
, Comma Operator
(or)
Punctuator
: Colon
; Semicolon
* Astrisk
" " Quotes
' ' Ellipsis


C and C++ ( C99 ) provide the following alternative representations for some operators and punctuators.
Operator
or
punctuator
Alternative
Representation
# %:
## %:%:
{ <%
} %>
[ <:
] :>

Example for using Alternative representation.
// Alternative Representation Example
%:include<stdio.h>
int main()
<%  //  Open Brace {.
char a<:5:>="MDSN";  // Array subscript operator Ex: a[5]="MDSN"
printf("%s",a);  // Output MDSN
return 0;
%>  // Close Brace {.

Some more alternative representation defined as macros in the header file " iso646.h".
Operator
or
punctuator
Alternative
Representation
& bitand
&& and
&= and_eq
| bitor
|| or
|= or_eq
^ xor
^= xor_eq
! not
!= not_eq
~ compl

Example:
  %:include<stdio.h> //  # preprocessor 
  %:include<iso646.h>
  int main()
  <%  //  Open Brace {.
  int a=5,b=5,c=2;
  if((a==5)and(a==b)) //if((a==5)&&(a==b))
  {printf("a=5 and a=b\n");}
  
  if(a not_eq c) //if(a != c)
  {printf("a is not equal to c\n");}
  return 0;
  %>  // Close Brace {.