LearnC Introduction
LearnC Introduction
Learn C: Introduction
Syntax in C
The rules that dictate the correct format of code for a // Statements must end in a semicolon (;)
specific programming language are known as syntax.
// correct
Examples of syntax in C are:
• All statements must end with a semicolon, ; printf("Hello World!");
• Keywords and other code elements are case-
sensitive
// error
When compiling C code, an error will occur when the
syntax of the code is incorrect. printf("Hello World!")
// error
PRINTF("Hello World!");
Escape Sequences
In C, an escape sequence is a non-visual character used // \n acts as a newline in a string
within a string.
printf("Hello\nWorld!"); // Outputs: Hello
\n is an escape sequence that adds a newline to a
string. \t is an escape sequence that adds a tab of //
spaces to a string. World!
/* This is a
block comment */
Print Share