Question: How do you allocate a matrix using a single pointer in C?(r and c are the number of rows and columns respectively)
Options
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));
Data Structure Matrix more questions
In function free(p), p is a _______
Which data type is used to represent the absence of....
Which of the data types has the size that is....
Which of the following declaration will result in run-time error?
The correct statement for a function that takes pointer to....
Which of the following is illegal?
Which of the following is not a valid variable name....
Which of the following function declaration is illegal?
What is the correct syntax of declaring array of pointers....
How do you instantiate an array in Java?
Data Structure Adjacency List more Online Exam Quiz
Data Structure Kadanes Algorithm
Data Structure Linear Search Iterative
Data Structure Longest Common Subsequence
Data Structure Longest Increasing Subsequence
Data Structure Longest Palindromic Subsequence
Data Structure Matrix Chain Multiplication
Data Structure Maximum Sum Continuous Subarray 1
Data Structure Minimum Number Jumps