Quiz Yourself on Arrays
Explore key concepts of arrays and pointers in C through an interactive quiz. Learn to apply pointer arithmetic, understand array decaying, and improve your skills in passing arrays to functions.
We'll cover the following...
We'll cover the following...
Arrays and pointers
1.
Given the following code:
#include <stdio.h>
int x[5];
int main()
{
int y[3];
static int z[2] = {0, 1};
return 0;
}
Where are x, y, and z stored?
A.
xis placed inside thedatasection.yis placed on the stack.zis placed inside thebsssection.
B.
xis placed inside thebsssection.yis placed on the stack.zis placed inside thedatasection.
C.
xis placed inside thedatasection.yis placed in thedatasection.zis placed inside thebsssection.
D.
xis placed inside thedatasection.yis placed on the stack.zis placed on the stack.
1 / 5
1.
The following question is more complex. Make sure to allocate enough time for it before you check the solution.
Given the following matrix declaration:
char matrix[2][3];
What is the equivalent of matrix[i][j] in pointer notation?
Make a memory drawing to find the formula. Consult the hint below if needed.
Show Answer
Did you find this helpful?
Follow the ...