Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////
- // main.cpp //
- //////////////
- #include <stdio.h>
- int newFoo(int i);
- void printFooNum();
- static int foos[] =
- {
- newFoo(1),
- newFoo(2),
- newFoo(3),
- newFoo(4)
- };
- int main()
- {
- printFooNum();
- printf("\n\nThe program has ended..\n"); fflush(stdin); getchar();
- return 0;
- }
- /////////////////////
- // anotherFile.cpp //
- /////////////////////
- #include <stdlib.h>
- std::vector<int> foo;
- int newFoo(int i)
- {
- foo.push_back(i);
- printf("Adding foo [addr: 0x%X]. New size: %d\n", &foo, foo.size());
- return i;
- }
- void printFooNum() { printf("foo [addr: 0x%X] size: %d\n", &foo, foo.size()); }
Advertisement
Add Comment
Please, Sign In to add comment