Question
All in C 1- Which of the following statements is correct about the following code snippet? A. j and i are pointers to an int.
All in C
1- Which of the following statements is correct about the following code snippet?
A. | j and i are pointers to an int. | |
B. | i is a pointer to an int and stores the address of j. | |
C. | j is a pointer to an int and stores the address of i. | |
D. | j is a pointer to a pointer to an int and stores address of i. |
2- In the following program, after Statement A is executed, the new address of ptr will be _________________ bytes more than the old address. (Assume that each int is stored in 4 bytes.)
#include
int one_d[] = {1,2,3};
void main()
{
int *ptr;
ptr = one_d;
ptr +=3; /*Statement A*/
printf(%d , *ptr); /Statement B */
}
A. | 12 | |
B. | 8 | |
C. | 3 | |
D. | 4
|
3- Any element of array declared as:
int arr[3][4];
can be accessed in pointer notation (where i represents row index and j represents column index) with generic formula as:
A. | *(*arr + i +j) | |
B. | **(arr + i) +j) | |
C. | *(*(arr + i) +j) | |
D. | (*(*(arr) + i) +j) |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started