Q158
How do you allocate a matrix using a single pointer in C?(r and c are the number of rows and columns respectively)
A.
int *arr = malloc(r * c * sizeof(int));
B.
int *arr = (int *)malloc(r * c * sizeof(int));
AnswerC.
int *arr = (int *)malloc(r + c * sizeof(int));
D.
int *arr = (int *)malloc(r * c * sizeof(arr));
Answer: Option B
Solution
Answer: Option B
No explanation is given for this question Let's Discuss on Board