Question: Suppose we have a one dimensional array, named ‘x’, which contains 10 integers. Which of the following is the correct way to allocate memory dynamically to the array ‘x’ using malloc()?

Options

A : x=(int*)malloc(10);

B : x=(int*)malloc(10,sizeof(int));

C : x=malloc(int 10,sizeof(int));

D : x=(int*)malloc(10*sizeof(int));

Click to view Correct Answer

Previous ||

C Interview Dangling Pointers more questions

Which of the following is not the properties of XOR....

Which of the following is an incorrect SOP expression?

The expression for involution law is _________

What is the complement of X’Y’Z?

If ? is the complex cube root of unity, then....

Which of the mentioned below is the formula to calculate....

What are the tangents to the curve y2=4ax at the....

What are the tangents to the curve x3+ y3=3axy at....

If A[x+3][y+5] represents an adjacency matrix, which of these could....

Which of the following logic expressions represents the logic diagram....

Chemical Engineering Basics - Part 1 more Online Exam Quiz

Casting Written Test

C Dangling Pointers

C Endianness

C General Utilities

C Inline

C Interview Date Time Function

C Interview General Utilities

C Interview Mathematical Functions

C Interview String Operations

C Library Multiple Choice