A quick question #include void doSomething(void); int - TopicsExpress



          

A quick question #include void doSomething(void); int main(void) { for (int i = 0; i < 2; i++) { doSomething(); } } void doSomething(void) { int x; } regardless of the counter variable i, the total amount of space that this program would use on most of 32-bit machines is 8 bytes — because I declared the variable x twice. However, at the same time, it only uses 4 bytes at a time. So its sort of reusing space. Im gonna refer to this as the actual space regardless of its actual terminology that I dont know yet. :) My question is, when were talking about the amount of space that a program consumes, are we referring to the total space or the actual space? For example, when the professor was demonstrating merge sort in one of the lectures, he minimized his use of space by using twice as much space as the array that was being sorted used. Does this mean that the program does NOT exceed this limit at any time or does it use a total of twice as much space as the array that was being sorted used? Thank you!
Posted on: Tue, 23 Sep 2014 07:00:29 +0000

Trending Topics



Recently Viewed Topics




© 2015