SHETTY_SIR's_CODING_ACADEMY
Code, Create, Conquer!
Programming Basics

Programming Basics

Master C, C++, Java, Python, Data Structures & Algorithms, and Machine Learning with interactive examples

C Programming Fundamentals

🔤

Introduction to C Programming
Beginner

Learn the fundamentals of C programming language

📖 Definition

C is a general-purpose, procedural programming language developed by Dennis Ritchie in 1972. It is a low-level language that provides direct access to memory and hardware, making it efficient for system programming.

🎯 Key Concepts
Procedural Programming
Low-level Memory Access
Portability
Efficiency
main.c
#include <stdio.h>

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

This is the basic structure of a C program. The #include directive includes the standard input/output library, and main() is the entry point of the program.

📊

Variables and Data Types
Beginner

Understanding different data types in C

📖 Definition

Variables are named memory locations that store data values. Data types define the type and size of data that can be stored in variables.

🎯 Key Concepts
Memory Allocation
Type Safety
Size Specifications
Value Storage
main.c
int age = 25;
float salary = 50000.50;
char grade = 'A';
double pi = 3.14159;

printf("Age: %d\n", age);
printf("Salary: %.2f\n", salary);
printf("Grade: %c\n", grade);
printf("Pi: %.5f\n", pi);

C supports various data types: int for integers, float for decimals, char for characters, and double for high-precision decimals.

🔄

Control Structures
Intermediate

Mastering loops and conditional statements

📖 Definition

Control structures are programming constructs that determine the flow of program execution based on conditions and loops.

🎯 Key Concepts
Conditional Logic
Loop Control
Flow Control
Decision Making
main.c
// If-else statement
if (age >= 18) {
    printf("Adult\n");
} else {
    printf("Minor\n");
}

// For loop
for (int i = 0; i < 10; i++) {
    printf("%d ", i);
}

// While loop
int count = 0;
while (count < 5) {
    printf("Count: %d\n", count);
    count++;
}

Control structures allow you to make decisions and repeat code blocks. Use if-else for conditions, for/while for loops.

⚙️

Functions
Intermediate

Creating reusable code blocks

📖 Definition

Functions are self-contained blocks of code that perform specific tasks. They promote code reusability and modularity.

🎯 Key Concepts
Code Reusability
Modularity
Parameter Passing
Return Values
main.c
// Function declaration
int add(int a, int b) {
    return a + b;
}

// Function with void return type
void greet(char name[]) {
    printf("Hello, %s!\n", name);
}

int main() {
    int result = add(5, 3);
    printf("Sum: %d\n", result);
    
    greet("Student");
    return 0;
}

Functions help organize code into reusable blocks. They can return values or perform actions without returning anything (void).

📦

Arrays
Intermediate

Working with collections of data

📖 Definition

Arrays are collections of elements of the same data type stored in contiguous memory locations.

🎯 Key Concepts
Contiguous Memory
Index-based Access
Fixed Size
Homogeneous Data
main.c
// Array declaration and initialization
int numbers[5] = {1, 2, 3, 4, 5};

// Accessing array elements
printf("First element: %d\n", numbers[0]);
printf("Last element: %d\n", numbers[4]);

// Looping through array
for (int i = 0; i < 5; i++) {
    printf("numbers[%d] = %d\n", i, numbers[i]);
}

Arrays store multiple values of the same type. Elements are accessed using index numbers starting from 0.

📍

Pointers
Advanced

Understanding memory addresses

📖 Definition

Pointers are variables that store memory addresses of other variables. They provide direct access to memory locations.

🎯 Key Concepts
Memory Addresses
Indirect Access
Dynamic Memory
Address Arithmetic
main.c
int number = 42;
int *ptr = &number;  // Pointer to number

printf("Value: %d\n", number);
printf("Address: %p\n", (void*)&number);
printf("Pointer value: %d\n", *ptr);

// Modifying value through pointer
*ptr = 100;
printf("New value: %d\n", number);

Pointers store memory addresses. They allow direct manipulation of memory and are fundamental to C programming.

Ready to Practice?

Start a new journey with our Academy