auto const array = new int[6] {1, 2, 3, 4, 5}; auto const myptr = &array; int* myptr_2[] = { (array), (array + 1), (array + 2), (array + 3), (array + 4), (array + 5) }; std::clog << (*myptr)[1] << std::endl; std::clog << (*myptr_2[1]) << std::endl; First, you have a pointer to pointer which at the end, the last pointer points to an array and you have to first dereference it, then subscript it. But the second one looks like just you have an array of pointers.
What is the benefit of using clog over cout?
Completely different
(*myptr)[12] is a pointer to an array (or a pointer) (*myptr[12]) is an array (or a pointer) that have elements which are pointers
It's my preferences, easier to type .
By this I guess you are shirazi😂
int* myptr_2[] = { &array[0], &array[1], &array[2], &array[3], &array[4], &array[5] }; all , that part is pretty stupid to write like that
What is your suggestion for that example?
Обсуждают сегодня