In any programming language, **syntax** is like grammar in human language. It defines how we write code correctly. In C, syntax rules are strict. Even a small mistake like a missing semicolon can cause errors.
๐ Quick Note: C is a **case-sensitive** language. Main
and main
are different.
#include <stdio.h> // Header file int main() { // Main function printf("Hello!"); // Statement return 0; // Return statement }
//
for single line or /* */
for multi-line.stdio.h
.#include <stdio.h> int main() { // This is a single-line comment printf("Learning C Syntax!"); // Print statement return 0; }
Modify the code to:
\n
for line breaks.{ }
main
or printf
Main
instead of main
)โ ๏ธ Syntax Tip: Always compile your code to catch syntax errors. The compiler will point out which line has an error.
main()
function.โ Challenge: Write a program that prints your favorite quote and uses both single-line and multi-line comments.
Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!