howdy~
i heard that array are actually a pointer, so i test it and all seems that remarks told the truth like this:
all three of them have the same output, which make me believe arr is absolutely a pointer itself. but if we declare a dynamic array this time, just like this:Code:int arr[100]; std::cout << arr << std::endl; std::cout << &arr << std::endl; std::cout << &arr[0] << std::endl;
to my surprise this time output is different from the former, here arr and &arr[0] are still be equivalent, but &arr show me another result, if the assumption which regards array as pointer didnt go wrong then the output for &arr and arr may be the also the same because they are all points to same area, what's wrong here ??? very confused...Code:int n = 100; int* arr = new int(n); std::cout << arr << std::endl; std::cout << &arr << std::endl; std::cout << &arr[0] << std::endl;![]()



LinkBack URL
About LinkBacks



