Posts
Functions in c
- Get link
- X
- Other Apps
C Functions Interactive Learning Functions in C - Interactive Learning 1. What is a Function? A function is a block of code that performs a specific task. Functions help in code reusability and better structure. 2. Function Declaration (Prototype) Syntax: return_type function_name(parameters); Example: int add(int a, int b); 3. Function Definition Syntax: return_type function_name(parameters) { // body of the function return value; } Example: int add(int a, int b) { return a + b; } 4. Function Call Syntax: function_name(arguments); Example: #include <stdio.h> int add(int, int); int main() { int result = add(5, 10); printf("Sum = %d", result); return 0; } 5. Built-in (Library) Functions These are pre-defined functions in header files. Examples: ...
ARRAYS IN C
- Get link
- X
- Other Apps
Array Concept in C Array Concept in C Understanding Arrays with Examples, Memory Representation, and Operations 📌 What is an Array? An array is a collection of similar data types stored in contiguous memory locations. It allows storing multiple values under a single name, and each value is accessed using an index. int a[5]; // array of 5 integers ⭐ Features of Arrays Stores multiple values of the same data type. Memory is allocated contiguously. Access using an index (starts from 0). Provides random access to elements. Fixed size (decided at compile time). 📝 Declaration & Initialization int marks[5]; int marks[5] = {10, 20, 30, 40, 50}; int marks[] = {10, 20, 30, 40, 50}; ➡️ Accessing Elements printf("%d", marks[0]); // 10 printf(...
Looping statements in c
- Get link
- X
- Other Apps
Looping Statements in C 🔁 Looping Statements in C Loops allow repeating code multiple times until a condition is satisfied. 1️⃣ for Loop 📘 Full Definition The for loop is used when the number of iterations is known in advance. It combines initialization, condition, and increment/decrement in a single line. ⚡ Shortcut: Best for fixed repetitions. 🔹 Syntax: for(initialization; condition; update) { // code to execute } Show Example #include <stdio.h> int main() { for (int i = 1; i 2️⃣ while Loop 📘 Full Definition The while loop is used when the number of iterations is not known in advance. It keeps executing as long as the condition is true. ⚡ Shortcut: Repeat while condition is true. 🔹 Syntax: while(condition) { // code to execute } ...
Conditional statements in C
- Get link
- X
- Other Apps
Conditional Statements in C ✨ Conditional Statements in C Conditional statements help control the flow of a program based on conditions. 1️⃣ if Statement 📘 Full Definition The if statement in C is used to execute a block of code only when a given condition is true. If the condition evaluates to false, the code inside the if block is skipped. ⚡ Shortcut Definition if = Runs code only when condition is true. 📝 Syntax if (condition) { // statements; } Show Example #include <stdio.h> int main() { int age = 18; if (age >= 18) { printf("You are eligible to vote."); } return 0; } 2️⃣ if-else Statement 📘 Full Definition The if-else statement provides two alternative paths of execution. If the condition is true,...
C syllabus for beginners
- Get link
- X
- Other Apps
C Language Syllabus 📘 C Language Syllabus Outline Unit 1: Introduction to C History and Importance of C Structure of a C Program Compilation and Execution Process printf() and scanf() Functions Simple C Programs (Hello World, Sum of Numbers) Unit 2: Operators and Expressions Arithmetic Operators Relational Operators Logical Operators Bitwise Operators Assignment Operators Increment/Decrement Operators Conditional (Ternary) Operator Operator Precedence and Associativity Unit 3: Control Structures if, if-else, nested if-else switch-case statement for loop while loop do-while loop break and continue goto statement Unit 4: Functions in C Definition and Declaration Types of Func...
Quiz on basic c
- Get link
- X
- Other Apps
C Language Mock Test 📝 C Language Mock Test (30 Marks) 1. Who developed the C programming language? Dennis Ritchie James Gosling Bjarne Stroustrup Charles Babbage 2. Which year was C developed at Bell Labs? 1969–1972 1978 1989 1999 3. Which function is the entry point of every C program? main() start() init() begin() 4. Which symbol is used for single-line comments in C? // /* */ # -- 5. Which data type is used to store decimal values? float int char void 6. In C, which keyword defines a constant variable? const constant ...