Created
November 2, 2013 21:11
-
-
Save jeffcrouse/7283559 to your computer and use it in GitHub Desktop.
compile with g++ -o blocks blocks.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main () | |
| { | |
| int foo[4]; | |
| double bar[4]; | |
| // Print out the memory addresses of all 4 elements of "foo" | |
| for(int i=0; i<4; i++) | |
| { | |
| cout << "&foo[" << i << "] = " << &foo[i] << endl; | |
| } | |
| // Do the same for "bar" -- notice that "bar" is doubles | |
| for(int i=0; i<4; i++) | |
| { | |
| cout << "&bar[" << i << "] = " << &bar[i] << endl; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment