Praveen said:
Hi
Can anybody tell me, where memory will be allocated for Function
parameters and return value of a function.
Are these stored on stack area, or data area, or any where else.
C implementations have a lot of freedom in this area. On many
implementations/platforms, function parameters are passed in a
defined set of registers and if the registers are for some reason
not enough, the stack is used (as well). The same for return
value: often a register but the stack is used for this as well.
I said 'implementations/platforms' because in many cases the C
implementation is not (fully) free to choose which registers to
use; this because the platform (i.e., the operating system or even
the CPU design) has certain rules as well. Using the same rules
on a platform also makes linking modules written in different
programming languages easier/possible; of course when all compiler
adhere to the same or compatible rules.
As a portable C programmer you don't need to know how and where,
and that's a great thing about this language!
Case