🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to C Notes
Topic #4

C Syntax


Syntax

You have already seen the following code a couple of times in the first chapters. Let's break it down and understand what each part does:

Example

#include <stdio.h>

int main() {
  printf("Hello World!");

return 0;
}

Example explained

Line 1: #include <stdio.h> tells C to include a header file. This header lets us use input/output functions such as printf() (used in line 4).

Note: Don't worry if you don't understand how #include <stdio.h> works. Just think of it as something that (almost) always appears in your program.

Line 2: A blank line. C ignores extra spaces and blank lines, but we use them to make the code easier to read.

Line 3: main() is a special function. Your program starts running here. Any code inside the curly brackets {} will be executed.

Line 4: printf() is a function used to output (print) text to the screen. In our example, it prints Hello World!.

Note: Every C statement ends with a semicolon ; Note: The body of int main() could also be written as: int main(){printf("Hello World!");return 0;} Remember: The compiler ignores extra spaces and new lines, but using multiple lines makes code easier to read.

Line 5: return 0 ends the main() function and sends a value back to the operating system.

Returning 0 usually means "everything worked". You will learn more about return values later.

Line 6: Do not forget the closing curly bracket } to end the main() function.

Want to go beyond the notes?

Join CodingNow 2.0's C course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

C Syntax – FAQs

Quick answers about learning C Syntax in C.

This free note from CodingNow 2.0 explains C Syntax in C — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every C topic on CodingNow 2.0, including C Syntax, is 100% free with no signup required.
With focused practice, most students grasp C Syntax in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now