I have dynamically created a 2d bool array and was wondering if i could create a pointer that points to the second column of the array.
tr6699 0 Newbie Poster
Recommended Answers
Jump to PostYou could do it something like this, which increments the pointer by 2 on every loop iteration.
int main() { int array[10][2] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}; int* p = (int *)&array[0][1]; for(int i = 0; i < 10; i++) { std::cout << *p << '\n'; p += 2; } …
All 4 Replies
vmanes 1,165 Posting Virtuoso
tr6699 0 Newbie Poster
vmanes 1,165 Posting Virtuoso
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.