继续在我的某个功能中出现此错误。不确定为什么。
错误:从类型
分配到类型struct card
struct card *
时出现不兼容的类型
Struct card** shuffleDeck(Struct card deck[], int size)
{
int i, j;
struct card temp;
struct card** dealerDeck;
dealerDeck = malloc(size*sizeof(struct card*)*4);
for(i=0; i<size; i++)
{
dealerDeck[i] = (struct card**)malloc(size*sizeof(struct card));
j = rand()%size;
temp = dealerDeck[i]; //ERROR ON THIS LINE
dealerDeck[i] = dealerDeck[j];
dealerDeck[j] = temp; //ERROR ON THIS LINE
}
};
任何帮助表示赞赏!
答案 0 :(得分:1)
首先,要使temp = dealerDeck[i];
发生temp
struct card *temp
,请输入struct card *temp = NULL;
/* memory allocation */
temp = dealerDeck[i]; /* now its possible */
malloc
同时避免施放var s = "shuan3jia4";
var arr = s.split(/([0-9])/);
console.log(arr);
。