In C language, the semicolon (;) is used to terminate statements. It is a punctuation mark that tells the compiler where a statement ends.
In C, statements can be expressed on a single line or multiple lines. For example, a single-line statement to print “Hello, World!” on the console using the printf() function would look like this:
printf("Hello, World!"); // This is a statement
A multi-line statement to assign a value to a variable named “x” would look like this:
int x; // This is a statement
x = 10; // This is a statement
In both cases, the semicolon is used to indicate the end of the statement.
It’s important to note that forgetting to include a semicolon at the end of a statement can lead to errors during compilation. The compiler will typically generate an error message indicating that a semicolon is expected to terminate the statement.