/*
* Jerzy Tomasik, 20-Jul-1991
* Stack usage during function calls
* in a C program
*/
#include <stdlib.h>
#include <stdio.h>
struct big_struct
{
char array[1024];
};
/* A copy of big_struct is passed to this function
* on the stack, 1024 bytes of stack space are
* used to store the copy. The function does not
* have access to the original structure
*/
void by_value(struct big_struct big, int dummy)
{
}
/* An address of big_struct is passed to this function.
* This uses only 2 bytes of stack space (under small
* memory model), but any changes to the structure
* will be reflected in the original. This is NOT
* a copy!
*/
void by_address(struct big_struct *big, int dummy)
{
}
int main(void)
{
struct big_struct big;
int dummy;
by_value(big, dummy);
by_address(&big, dummy);
return(0);
}
/* End of File */