This program will finally allocate the memory of ___ bytes that “ptr” will point to. #include<stdio.h> #include<stdlib.h> int main() { char *ptr; ptr = (char*)malloc(sizeof(char)*4); ptr = (char*)realloc(ptr,sizeof(char)*8); return 0; }单项选择题
A
8
B
16
C
4
D
32
登录即可查看完整答案
我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。
类似问题
how might you interpret it if tmp == NULL (tmp pointer is NULL) after this calloc statement? In other words what are possibilities? tmp = calloc(elem, size);
How much memory should be malloc'ed? In other words, how would you replace XXXXXXXXXX ? The strcpy definition is: char* strcpy(char* dest, const char* src); /* return a freshly-malloc'd copy of s */ /* or 0 if malloc fails */ /* It is the caller's responsibility to free the returned string when done. */ char *strdup(const char *s) { char *s2; s2 = malloc(XXXXXXXXXX); if(s2 != 0) { strcpy(s2, s); } return s2; }
Which of the following will zero the memory allocated?
Consider the function call: p = (data_t *)malloc((num - 1) * sizeof(data_t)) The intention of this function call is best described as:
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!