Control statements in C: - C is a structure-orientated programming language; the statements that are used to control the flow of execution of a program are called control structures. The statements provide a specific order to execute the C program. In C programming, we have four types of control structures. Sequential control structures Conditional control structures Iterative control structures Jumping control structures 1) Sequential control structures: - The C program is a collection of instructions or set of statements which are executed sequentially in a user-specific order. No statement is slipped, and no statement is executed more than once. Syntax: - Flow chart: - Example: - Output: - 1) Conditional control structures: - It is also known as selection, branchi...
Arrays: - An array is a collection of elements of the same data type stored in contiguous memory locations. It is a derived data type and a homogenous data structure. It is a variable which can store multiple values of the same type under a single variable name, making it easier to manage and manipulate related data. The size of an array is fixed. To access the elements of an array, we use indexes or subscripts accordingly. array index or subscript is used to identify array elements address. Array index or subscript starts with 0 to n-1. Declaration of an array: - The declaration of an array means telling the compiler to create an array variable and reserving memory for a fixed number of elements of the same data type. Initialization of an array: - Initializing an array means assigning initial values to its elements. Types of arrays: - Arrays are classified based on the number of dimensions they have: ...
Parameter passing techniques: - Parameters are the values or variables that are passed to a function when it is called. These parameters allow data to be shared between the calling function (main) and the called function (sub function). There are mainly two types of parameter passing techniques in C: 1. Call by Value 2. Call by Reference 1) Call- by-value: - Call by value is a method of passing arguments to a function in which a copy of the actual variable’s value is passed to the function. Any changes made inside the function do not affect the original variable outside the function. Example: - Output: - 2) Call-by-reference: - Call by addr...