malloc 函式回傳void指標(無型態),由於ptr為指向整數變數的指標,因此須再轉換型態。 小三元公式:. int *ptr, n=4; //1.宣告. ptr=(int*)malloc(sizeof(int)*n); //2.
確定! 回上一頁