int** returnColumnSizes = (int**)malloc(sizeof(int*) * 100); why should we cast the returned pointer to an int double pointer
时间: 2023-11-21 11:04:18 浏览: 119
C语言中char*和char[]用法区别分析
We need to cast the returned pointer to an int double pointer because the malloc() function returns a void pointer (void*) and we need to cast it to the appropriate type before assigning it to a variable. In this case, we need to cast it to an int double pointer because we are allocating memory for an array of integer pointers (int*) and we need to store the address of this array in a variable of type int double pointer (int**).
阅读全文