pointers

    0熱度

    1回答

    我想爲struct,mallocs的內存,並設置字段的指針作出結構的構造函數。但是,當我打印我相信我已經設置的內容時,我看到這些字段是空的。我也使用C99 void init_student(struct student* student, char* name, int id, float gpa) { student = (struct student*) malloc(sizeof

    -2熱度

    1回答

    你好我有一個節點類: public class NodoLista{ private int dato; private NodoLista sig; //next public void setSig(NodoLista s){ this.sig=s; } public NodoLista getSig(){

    -4熱度

    1回答

    在與std::thread一起使用的情況下,宣佈函數爲void和void*是否有區別? void encrypt(/*parameters*/) { } // ... std::thread(encrypt, /*arguments*/); 我只是讀一些有關使用void*在互聯網上線,並希望確保我使用void,而不是void*一個很好的理由。我通常強調我寫的東西太多了。

    -1熱度

    1回答

    #include <stdio.h> int main(void) { short x[12]; unsigned char *cp; short *sp; int *ip; int i; for (i = 0; i < 12; i++) { x[i] = i + 1; } cp = (unsigned

    1熱度

    3回答

    我對指針初始化的概念性理解處於停滯狀態。 我已經創建了一個數組是這樣的: int *A = NULL; A = new int[p]; 現在試圖模擬插入值這個數組,A 這裏是收集,試想如果陣列已放置一些值。 例如: A[0]= 10; A[1]= 4; A[2]= NULL; A[3]= 2; 我將如何限制的,如果檢查語句,如果數組爲空? 迭代通過與我的數組值和檢查 if(A[i]

    -2熱度

    2回答

    沒有錯誤,但我期待10個值,但我只有一個值。以下是我的創建和顯示功能。 void create() { int random; for (int i = 0; i < 10; i++) { struct node *new_node, *current; new_node = new node; random = randomNum(); new_n

    3熱度

    3回答

    鏈表: pointer2 -> [a] pointer ->[a] -> [b] -> [c] -> [d] -> null pointer = b; //makes it point one down so it will be pointer -> [b] ->[c] -> [d] -> null pointer = pointer 2; //makes pointer point

    3熱度

    1回答

    我一直在使用C庫從R以使用圖書館的功能編寫自定義的C函數,然後使用.C-接口與R訪問這些C-功能。 在一些C代碼的,我對一些自定義的結構分配空間,並希望存儲R中三分球給他們,讓我可以在連續調用.C使用這些結構。在使用.C函數時,我注意到我可以簡單地將指針轉換爲C結構來整型,並將它作爲整數存儲在R中。將此整數傳遞給稍後通過.C調用可以正常工作,我可以跟蹤我的結構並毫無問題地使用它們。 我有點幼稚的問

    2熱度

    4回答

    我想連接字符指針中存儲的兩個字符串,但我做錯了什麼。請有人指出它是什麼嗎?另外,我沒有故意使用任何內置函數。 int main() { char *a = "abc"; char *b = "def"; char *c; while(*a != '\0') { *c = *a; a++; c++;

    0熱度

    1回答

    這是一個將sting的字母轉換成大寫或小寫的程序。我不知道這段代碼有什麼問題。當我運行它時,它省略了第一個字母。如果我給出字符串「Lets out out」,則輸出爲 「ETS GO OUT」(將「L」排除在外,不應該發生)轉換爲大寫字母並且「ts out out」(「 le「被排除在外,這是不應該發生的)當轉換爲小寫。我使用codeblocks。請有人幫助我:'( #include<ctype.