C Basic Syntax


Before riding the roller coaster of the C Programming journey let’s first get familiar with the basic syntax of a C program.

Below is the basic program which you can write as your first C program.

#include <stdio.h>

int main(void) {
  char name[10];
  scanf("%s", name);
  printf("hello, %s\n", name);
  return 0;
}

C Programming Language is made up of several components that work together to create a coherent and procedural programming language.

Some of them are

  1. Keywords
  2. Variables
  3. Constants
  4. Comments
  5. Preprocessors
  6. Identifiers
  7. Data Types
  8. Operators
  9. Functions
  10. Control Structures
  11. Expressions

A basic C program looks like this:

#include <stdio.h> // Include the standard input/output library

int main() { 
    printf("Hello, World!\n"); // Print "Hello, World!" followed by a newline
    return 0; 
}

We will discuss each part of the above program in the next chapter.