Dynamic Memory Allocation  in C with Example Dynamic memory allocation refers to the manual memory management in the C language. Need of Manual Memory Management/ Dynamic Memory Allocation : In case of array, the programmer must declare the size of the array during compile time (the time when a compiler compiles code written in a programming language…

Memory Layout of C++ Memory Layout of C++ : Let us understand how C++ organizes memory for its programs. After compiling a program, C++ create four logically distinct regions of memory that are used for different distinct specific functions. These are : Program Code Region Global Variables Region Heap Region Stack Region Regions : Program code…

Memory Layout in c

Memory Layout in c Memory Layout in C : Let us understand how C organizes memory for its programs. After compiling a program, creates distinct regions of memory that are used for different distinct specific functions. These regions are : Program code segment/region Data segment/region Initialised data or data segment Uninitialised data or .bss segment Stack…

Difference Between Array and Linked List Difference Between Array and Linked List : There are so many advantages and disadvantages between array and linked list and based on those factors I am trying to summarize the difference between array and linked list which are described as : Basis Arrays Linked Lists Insertion/Deletion in array and Linked List :…

Linked List

What is a Linked List in C ? Linked List = List is Linked. The term ‘list’ refers to a linear collection of data. One form of linear list are arrays in which elements are stored in memory by means of sequential (contiguous) memory locations. Another form of linear list are linked lists. “Linked list…

Pointer to Structure Structure is a User Defined Data Type. Before discussing Pointer to Structure, you must know about Structures. Example of a Structure : struct node { int a; float b; char c[2]; }; Point No 1 : It is a mixture of various data types. Point No 2 : Memory of a structure (Assume 16-bit Processor)…

Programs on Pointer to Array or on Multidimensional Arrays using Pointers Before Solving the Programs on Pointer to Array or on multidimensional array using pointers, Read out the Basics on the following link : Link : http://www.edugrabs.com/pointer-to-array-or-access-multidimensional-arrays-using-pointers/ Program Number 1 : Let the base address of array arr2D[3][3] is 1000. main() { int arr2D[3][3]; printf(“%d”, (arr2d==*arr2d)…

Function Pointer in C Function Returning Pointer Consider a simple program : main() { int *x; x=fun(); printf(“%u”,x); } int* fun() { int y=10; return &y; } Output of the Program : 2000 Explanation : So, It means that function is returning a pointer. Functional Pointer Consider a simple program to understand the meaning of…

Pointer to Structure Example Before Discussing  Pointer to Structure Example, Read out the basics on Structure and Pointers on the following link. Link : http://www.edugrabs.com/pointer-to-structure-basics/ Program No 1 : main() { struct s1 { char *z; int i; struct s1 *p; }; Struct s1 a[] = { {“NAGPUR”, 1, a+1} {“RAIPUR”, 2, a+2} {“KANPUR”, 3, a}…