正在加载图片...
Functions memory(cont) When a function is called a new stack frame is set aside Parameters and return values are passed by copy(ie, they' re copied into and out of the stack frame) When a function finishes its stack frame is reclaimed void afunc (int x, int y) double dl=x+ int main(int argc, const char argv[])[ int x =7 a Func(1, 2) Y aFunc a Func(2,3)i return 0; 7 main4 Functions & Memory (cont) ◼ When a function is called, a new stack frame is set aside ◼ Parameters and return values are passed by copy (ie, they’re copied into and out of the stack frame) ◼ When a function finishes, its stack frame is reclaimed void aFunc(int x, int y) { double d1 = x + y; } int main(int argc, const char * argv[]) { int x = 7; aFunc(1, 2); aFunc(2, 3); return 0; } x y d1 x 7 aFunc main
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有