Memory Layout In C

Basically, memory layout of C program contains five segments these are the stack segment, heap segment, BSS (block started by symbol), DS (Data segment) and text segment. Each segment has own read, write and executable permission. If a program tries to access the memory in a way that is not allowed then segmentation fault occurs….

In C macros is a segment of the code which has some unique name. Whenever in a program we used the macro name, it is replaced by the contents of the macro. These replacements occur before the compilation of the code that is the reason there is no type checking occur with macro in C….

Bubble Sort

Bubble sort is a simple sorting algorithm that sorts the elements in ascending and descending order. It repeatedly compares the adjacent elements and swaps them if they are in the wrong order. Example to understand Bubble Sort, Suppose there is an array which contains ” 5 1 4 2 8″. If you want to sort this…