Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.

C Language Basics

Structure of a C Program

#include <stdio.h>

int main() {
printf("Hello, World!");
return 0;
}

Key Components

  • #include <stdio.h> — Header file for input/output functions
  • int main() — Main function where program execution begins
  • printf() — Function to print output to the screen
  • return 0; — Indicates successful program execution

Variables & Data Types

int age = 15; // Integer
float marks = 85.5; // Floating point
char grade = 'A'; // Single character

Common Data Types

TypeSizeExample
int2/4 bytesint a = 10;
float4 bytesfloat b = 5.5;
char1 bytechar c = 'X';

Input & Output

int num;
printf("Enter a number: ");
scanf("%d", &num);
printf("You entered: %d", num);
  • %d — Integer format specifier
  • %f — Float format specifier
  • %c — Character format specifier
  • %s — String format specifier

Comments

// This is a single-line comment

/* This is a
multi-line comment */

Exam Tips

  • Always include stdio.h for input/output functions
  • main() function is mandatory in every C program
  • Use & before variable name in scanf()
  • Every statement ends with a semicolon (;)

← Back to Std 10

📍 Visit Us

🏫 VD Computer Tuition Surat

VD Computer Tuition
📍 Address
2/66 Faram Street, Rustompura
Surat395002, Gujarat, India
📞 Phone / WhatsApp
+91 84604 41384
🌐 Website

Computer Classes & Tuition — Areas We Serve in Surat

AdajanAlthanAmroliAthwaAthwalinesBhagalBhatarBhestanCanal RoadChowkCitylightDumasGaurav PathGhod Dod RoadHaziraJahangirpuraKamrejKapodraKatargamLimbayatMagdallaMajura GateMota VarachhaNanpuraNew CitylightOlpadPalPandesaraParle PointPiplodPunaRanderRing RoadRustampuraSachinSalabatpuraSarthanaSosyo CircleUdhnaVarachhaVed RoadVesuVIP Road
📞 Call Sir💬 WhatsApp Sir