C Syntax

C syntax, just like in other languages, is a whole of topics such as spelling, punctuation, spelling rules. If you fully master this topic, you can easily spot syntax errors in the C programs you develop and save time.


Program C consists of several tokens, and a token is either a keyword, an identifier, a constant, a string literal, or a symbol.

printf("Hello World! n");

Individual Tokens

   "Hello, World! n"


A semicolon in a C program is an expression terminator.That is, each expression must be terminated with a semicolon.A semicolon indicates the end of a logical entity.

printf("Hello, World! n");
return 0;


Comments are similar to the supporting text in your C program and are ignored by the compiler.They start with /* and end with */ characters, as shown below.

/* comment section */

You cannot comment within comments, and they cannot occur in a string or character literals.


Identifier C is a name used to define a variable, function, or any user-defined element.An identifier begins with a letter A through Z, a to z, or an underscore '_', followed by zero or more letters, underscores, and numbers (0 to 9), and identifiers can never begin with numbers..

C does not allow punctuation in identifiers such as @, $, and % .C is a case-sensitive programming language.Therefore, circuit nand Circuit are two different identifiers in C. Here are some examples of acceptable identifiers:

ardn circuit prog devre_yakan a_123
dvrykn _deneme j a9987 retVal


The following list shows the reserved words in C. These reserved words cannot be used as constants or variables, or as any other descriptive name.


Space (Whitespace)

A row with only spaces, possibly comments, is known as an empty line, and a C compiler completely ignores it.

Spaces in C are the term used to describe tabs, new line characters, and comments.A space separates one part of an expression from another, and allows the compiler to determine where an element, such as an int in an expression, ends and the next element begins.

int trial;

The compiler must have at least one space character between the int and the attempt to distinguish them.

fruits = apple + pear;

No space character is required between fruit and = or between = and apple, but you are free to add some if you want to improve readability.