1.

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));
C. int *arr = (int *)malloc(r + c * sizeof(int));
D. int *arr = (int *)malloc(r * c * sizeof(arr));
Answer» C. int *arr = (int *)malloc(r + c * sizeof(int));


Discussion

No Comment Found