Start your programming journey with one of the most powerful and foundational languages — C. This comprehensive course is designed for absolute beginners as well as intermediate learners who want to build a solid understanding of programming using the C language. Whether you're preparing for college-level programming, cracking technical interviews, or planning to explore systems or embedded development, this course covers everything step-by-step. Through hands-on examples, real-world practice problems, and structured explanations, you’ll learn how to write clean and efficient C code — from your first printf() to advanced data structures and memory management.
In C, variables are containers used to store data values. Each variable has a specific data type, which determines what kind of data it can store — like integers, characters, or floating-point numbers. Let's understand how to declare, use, and manage different data types in C.
A variable in C is a named space in memory that stores data. Think of it as a labeled box where you can put a value and use it later.
int age;
float price;
char grade;
You must declare a variable before using it. You can also assign a value at the time of declaration:
int age = 21;
float price = 99.50;
char grade = 'A';
| Data Type | Description | Example |
|---|---|---|
| int | Stores integers | int count = 5; |
| float | Stores decimal numbers (single precision) | float pi = 3.14; |
| double | Stores double precision decimals | double value = 3.141592; |
| char | Stores a single character | char letter = 'A'; |
#include <stdio.h>
int main() {
int age = 20;
float marks = 89.5;
char grade = 'A';
printf("Welcome to UdaanPath!\n");
printf("Age: %d\n", age);
printf("Marks: %.2f\n", marks);
printf("Grade: %c\n", grade);
return 0;
}
%d → for integers%f → for floats%.2f → float with 2 decimal places%c → for characters%s → for stringsint score; is better than int x;float takes less space than double
In the next chapter, we’ll explore how to accept user input in C using functions like scanf().