Skip to main content

Posts

Showing posts with the label C programming and tips

why addition of pointer is not possible

why addition of pointer is not possible Pointer are actually a variable with 2bytes of memories and it stores the address of any another variable ..so value stored in pointer will be the address and not the value of that variable.. for example: suppose int a =5; int *p=&a; and address of a is 115 and tht of p is 225... now the above code states tht value of a = 5; value of p = 115;//address of a

Memory layout in c program?

The distinction between stack and heap relates to programming. When you look at your computer memory, it is organized into three segments: •text (code) segment •stack segment •heap segment text (code) segment The text segment (often called code segment) is where the compiled code of the program itself resides. When you open some EXE file in Notepad, you can see that it includes a lot of "Gibberish" language, something that is not readable to human. It is the machine code, the computer representation of the program instructions -The two sections other from the code segment in the memory are used for data. stack segment The stack is the section of memory that is allocated for automatic variables within functions. Data is stored in stack using the Last In First Out (LIFO) method. This means that storage in the memory is allocated and deallocated at only one end of the memory called the top of the stack. Stack is a section of memory and its associated registers that