申请一个具有n个int型元素的一维动态数组 可以使用下面的哪条语句?
已帮助 人
申请一个具有n个int型元素的一维动态数组,可以使用下面的哪条语句?
A.p = (int *) malloc(n * sizeof(int));
B.p = (int *)calloc(n, sizeof(int));
C.p = (int *) malloc(n, sizeof(int));
D.p = (int *)calloc(n * sizeof(int));
E.int p[n];
F.p = (int *) realloc(n * sizeof(int));

回答
共1条回复-
p = (int *) malloc(n * sizeof(int));
