Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

We've seen that C++ stores statically-allocated multidimensional arrays in first-dimension-major order . Suppose, instead, that C++ stored them using last-dimension-major order (so, the opposite) instead.

We've seen that C++ stores statically-allocated multidimensional arrays in first-dimension-major order. Suppose, instead, that C++ stored them using last-dimension-major order (so, the opposite) instead. For example, suppose we had this statically-allocated array:

int a[3][2][2];

then suppose that its elements were stored contiguously in memory in exactly the following order which, again, is different from how C++ normally does it.

a[0][0][0]

a[1][0][0]

a[2][0][0]

a[0][1][0]

a[1][1][0]

a[2][1][0]

a[0][0][1]

a[1][0][1]

a[2][0][1]

a[0][1][1]

a[1][1][1]

a[2][1][1]

If that was the rule in C++, then which of the following function declarations would we expect to be illegal? For each one that you would expect to be illegal, explain in a sentence or two why. (Note that I'm asking this question generally, so the answer is never going to be "Because the capacity of x is not the same as the capacity of a in your example.")

void func1(int x[10][3]) void func2(int x[][10][20]) void func3(int x[30][]) void func4(int x[40][][][]) void func5(int x[][10][]) void func6(int x[10][][20])

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

Recommend the key methods to improve service productivity.

Answered: 1 week ago

Question

Consider this article:...

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago