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
- Keywords
- Variables
- Constants
- Comments
- Preprocessors
- Identifiers
- Data Types
- Operators
- Functions
- Control Structures
- 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.