Doubt in printing memory address of first element in array

Which of the following gives the memory address of the first element in
array aFoo, an array with 100 elements?

A) aFoo[0];
B) aFoo;
C) &aFoo;
D) aFoo[1];

When I run this program option B and C both give same answer, so which one is correct

Thanks a lot for your replies
Last edited on
This is the idea:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <array>
#include <iostream>

int main(void)
{
    int aFoo[100];
    std::array<int, 100> arFoo;
    std::cout << std::hex << aFoo << "\n";
    std::cout << std::hex << &(aFoo[0]) << "\n";
    std::cout << std::hex << &(arFoo[0]) << "\n";
    std::cout << std::hex << arFoo.begin() << "\n";
    std::cout << std::hex << arFoo.data() << "\n";
    return (0);
}


Link: http://ideone.com/Xak05J
This also produce same answer as I stated above so what is the correct option
Last edited on
Topic archived. No new replies allowed.