Posts

Showing posts from October, 2025

Important questions in c language 2units

Functions in c

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: ...