0 votes
in C Plus Plus by

Which of the following is a valid way to allocate memory dynamically in C Language?

A) int *ptr = malloc(10);

B) int *ptr = new int[10];

C) int *ptr = calloc(10, sizeof(int));

D) All of the above

1 Answer

0 votes
by
Answer: D

Explanation: All three options are valid ways to allocate memory dynamically in C Language. Option A uses the malloc function, option B uses the new operator (which is used in C++ as well), and option C uses the calloc function.
...