codeGK
Code it ALL
C Syntax - CodeGK
♦ C Syntax

♣ About C Syntax

The syntax is the set of rules provided by the compiler.
These rules are supposed to be satisfied for program parsing.
Theory of Automata is used in compiler-building which makes the compilation efficient, else simple string parsing would have been a lot slower.

♣ Syntax in C

Below is the representation of C Syntax.
Basic Syntax
#include int main(){ //code_block return 0; }
Syntax Explanation:
#include : standard input/output library inclusion code_block: block of code to executed

♣ Example1: Right Syntax in C

In this example, all the arrangement of program satisfies the compilation rules and code runs without any error.
Example
Input:
Output:

♣ Example2: Wrong Syntax in C

In this example, there are multiple syntax violations:-
1) hash-character is missing before the stdio.h library inclusion.
2) ; is missing after the puts statement.
Example
Input:
Output:
Prev_LessonNext_Lesson