Dynamic Memory Allocation in C

July 25, 2021 0 Comments

Dynamic Memory Allocation in C, Dynamic memory allocation refers to memory allocation that occurs during the execution of a program and is controlled by the program. The compiler has no information about such memory at compile time. It’s given to programs as and when they’re needed, and it can be deallocated as needed. Dynamic variables …

Share This:

File I/O Operations in C

May 31, 2021 0 Comments

Command Line Arguments: File I/O Operations in C, Arguments passed to the main function from the command prompt are considered command-line arguments. signature of the main function is int main(int argc, char *argv[]) argument 1 in the main function will always hold a number of values passed which includes the executable name. argument 2 will …

Share This:

Strings in C

May 20, 2021 0 Comments

Strings in C, Anything enclosed in double-quotes treated as a string. There is no predefined data type to declare and use strings. So, we use character arrays to declare strings in C programs. Every string terminates a special character called a NULL character. Declaring and Initializing Strings: the syntax for declaring a string is as …

Share This:

Structures and Unions in C

May 15, 2021 0 Comments

Structures and Unions in C, A structure is a collection of one or more variables, possibly of different data types, grouped together under a single name to represent a single entity. Declaration: Initialization: struct Tag_name object = {init values} struct student var = {1, “sathi”, “ECE”, “ECE”}; Structure declarations will allow programmers to create new data …

Share This:

Function Pointers in C

May 15, 2021 0 Comments

Function Pointers in C, Function pointers can be useful when you want to create a callback mechanism and need to pass the address of a function to another function. They can also be useful when you want to store an array of functions, to call dynamically. Formally Syntax is type (*fun_pointer)(argument_type list); Example: float (*fp) (char , …

Share This:

Arrays in C

May 15, 2021 0 Comments

Arrays in C, It’s a kind of data structure that can store a fixed-size sequential collection of elements of the same type. It is used to store a collection of data, and a collection of variables of the same type. Formally syntax is Multidimensional Array Syntax: Arrays in C, Multidimensional Array syntax variable length arrays: variable-length …

Share This:

Pointers in C

May 15, 2021 0 Comments

Pointers in C, It is a variable that contains the address of a variable. Pointer Declaration:  pointer size is always equal to the word size of architecture. on 32-bit – 4 bytes 0n 64-bit – 8 bytes Pointers in C, It should initialize with the return value of the “&” operator or with NULL Pointer …

Share This:

Functions in C

May 15, 2021 0 Comments

Functions in C, A function is a block of code that performs a specific task. There are two types of function in C programming: 1. Standard library functions: The standard library functions are built-in functions in C programming.         ex : printf, scanf, etc 2. User-defined functions: You can also create functions as per your need. Such functions created …

Share This:

Control Statements in C

May 15, 2021 0 Comments

Control Statements in C If-Else: The if-else statement is used to express decisions. Formally the syntax is  If-Else Ladder: The if-else ladder statement is used to express multiple decisions. Formally the syntax is Switch: The switch statement is a multi-way decision that tests whether an expression matches one of a number of constant integer values, and …

Share This:

Data Types in C

May 15, 2021 0 Comments

Data Types in C, A data type is generally specified when declaring variables, arrays, functions, etc. In ANSI C, the data types are divided into three categories. They are: 1. Basic data types 2. User-defined data types 3. Derived data types Basic Data Types: There are few basic data types in C: Int: The int …

Share This: