我試圖創建一個程序,它接收一組字符串(用戶被要求輸入它們將輸入的字符串的數量),一旦它有這些字符串,它們被放置在一個數組中,使用動態內存。 的輸出中會是這樣的: # of Strings: 3
Cat
Dog
Elephant
Cat
Dog
Elephant
繼承人我的代碼片段,之後我有一個字符串的數量。 sptr=malloc(sizeof(char*)*nStrings);
我想'構造'(閱讀:malloc和memset)我的散列表c。要做到這一點,我創建了一個功能如下: int maketable(struct hash_entry **table, int size){
table = (struct hash_entry **)malloc(size*sizeof(struct hash_entry *));
int i = 0;
您好,我有以下代碼... int *a, *b;
int *d;
int N = 2000;
size_t size = N*sizeof(int);
a = (int *) malloc(size);
b = (int *) malloc(size);
...
cudaMalloc((void **) &d, size);