DIZNR INTERNATIONAL

What is C – part 2

What is C – part 2

https://www.gyanodhan.com/video/7A2.%20Computer%20Science/Let%20Us%20C%20Programming/188.%20Let%20Us%20C%20by%20Yashavant%20P.%20Kanetkar%20-%20What%20is%20C%20-%20part%202.mp4

💻 What is C? – Part 2: Intermediate Concepts

In Part 1, you likely learned the basics of the C programming language — such as data types, variables, operators, and simple input/output.

Now, in Part 2, we will explore intermediate concepts of C that are essential for building real programs.


Part 2: Key Topics in C Programming

1⃣ Control Statements (if, else, switch)

These are used to control the flow of the program based on conditions.

c
if (marks >= 40) {
printf("Pass");
} else {
printf("Fail");
}

2⃣ Loops (for, while, do-while)

Loops allow repeated execution of code blocks.

c
for (int i = 1; i <= 5; i++) {
printf("%d ", i);
}

3⃣ Functions

Functions are blocks of code designed to perform specific tasks.

c
int add(int a, int b) {
return a + b;
}

4⃣ Arrays

Arrays are used to store multiple values of the same type.

c
int marks[5] = {90, 85, 88, 75, 95};

5⃣ Pointers (Introduction)

Pointers store the address of a variable. This is a powerful concept in C.

c
int x = 10;
int *ptr = &x;
printf("%d", *ptr); // Outputs 10

Other Important Concepts

Concept Description
Structures Used to group different types of variables
File Handling To read/write from/to files
Recursion A function calling itself
Preprocessor Directives Commands like #include, #define

Example Program – Function & Loop

c
#include <stdio.h>

int multiply(int a, int b) {
return a * b;
}

int main() {
for (int i = 1; i <= 5; i++) {
printf("2 x %d = %d\n", i, multiply(2, i));
}
return 0;
}


Tip for Learners:


Would you like a Part 3 covering advanced topics like pointers to functions, dynamic memory, or file I/O?