You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
LECTURE NOTES OF ADVANCED DATA STRUCTURE (MT-CSE 110)<br />
This is because in case of call by value the value is passed to function named as<br />
interchange and there the value got interchanged and got printed as<br />
x1=70 y1=50<br />
and again since no values are returned back and therefore original values of x<br />
and y as in main function namely<br />
x=50 y=70 got printed.<br />
But in case of call by reference address of the variable got passed and therefore<br />
whatever changes that happened in function interchange got reflected in the<br />
address location and therefore they got reflected in original function call in<br />
main also without explicit return value. So value got printed as *x=70 *y=50 and<br />
x=70 y=50<br />
DYNAMIC MEMORY ALLOCATION<br />
Your computer's memory is a resource ‐ it can run out. The memory usage for<br />
program data can increase or decrease as your program runs.<br />
Up until this point, the memory allocation for your program has been handled<br />
automatically when compiling. However, sometimes the computer doesn't<br />
know how much memory to set aside (for example, when you have an unsized<br />
array).<br />
The following functions give you the power to dynamically allocate memory for<br />
your variables at RUN‐TIME (while the program is running). For the past<br />
tutorials, memory was allocated when the program was compiled (i.e. COMPILE‐<br />
TIME).<br />
To use the four functions discussed in this section, you must include the stdlib.h<br />
header file.<br />
Prepared By :<br />
Er. Harvinder Singh<br />
Assist Prof., CSE, H.C.T.M (Kaithal) Page ‐ 64 ‐