char-pointer

    0熱度

    1回答

    我有一個結構如下 struct st { std::string name; std ::string refer; int number; std::string path; }; 已經創建上述結構的陣列 struct st var[5]={{"rick1","ross1",1,"demo1"}, { "rick2","ro

    -1熱度

    1回答

    該程序正在排序數組中的字符串。 功能排序是它沒有編譯錯誤運行第3次後回採 int main(){ char * arrP1[] = { "father", "mother", NULL }; char * arrP2[] = { "sister", "brother", "grandfather", NULL }; char * arrP3[] = { "grandm

    -2熱度

    4回答

    我嘗試打印簡單的C *的字符串是這樣的: char *cc = "HEllo"; for (char* inputPtr = cc; inputPtr[0]; inputPtr++) { char c = inputPtr[0]++; printf("%s",c); } 但即時得到: 訪問衝突寫入位置0x00CFB310。

    1熱度

    1回答

    我在運行嘗試從剪貼板中讀取時遇到內存泄漏。 樣品的編號: void SomeFunction() { OpenClipboard(nullptr); HGLOBAL hglb = GetClipboardData(CF_TEXT); char* ch = static_cast<char*>(GlobalLock(hglb)); CString rawC

    3熱度

    1回答

    打印一個指向一個int後,我打印指向一個字符: #include <iostream> using namespace std; int main() { int i; cout << "&i: " << &i << endl; char q = 'q'; cout << "&q: " << &q << endl; return 0;

    1熱度

    3回答

    我的問題是關於廢棄一個字符指針 在這裏工作是我的代碼 - #define MAX 10 char s[80]="Hello"; int main(){ char *stackValue; stackValue=&s;//here I assined the address of s to stackValue if(!stackValue){

    -6熱度

    1回答

    字符串 例1: 當我走串輸入,它成功地給出了輸出,寫這一段代碼: #include <stdio.h> int main() { char *str; scanf("%s",&str); printf("%s",&str); return 0; } 情況2: 。另一方面,它拋出一個運行時錯誤的這個片段: #include <stdio.h> in

    0熱度

    1回答

    我從函數獲取指向塊(開始時爲空)的數據的指針。 這個指針是: char* data; 而我的工作就是在此塊中插入不同類型的數據。我只知道數據類型(字符串/整數/浮點數)及其以字節爲單位的長度。 例如,對於一個插入整數,我想給每個塊像一種形式: |block_num|age|weight|favorite_number| 所以我的主要問題是,我怎麼可以插入數塊,並讓他們喜歡?我希望像數據[3

    0熱度

    5回答

    在下面的程序, #include<stdio.h> #include<stdlib.h> int main(){ const char *str1 = "abc"; char *str2 = (char *)malloc(sizeof(char)*4); str2= "def"; str2[1]='s'; printf("str2 is %s"

    -3熱度

    1回答

    ,所以我試圖用凱撒密碼與char *的,我寫了一個簡單的函數出來是這樣的: char * Encrypt(char * s, int k) { char * c = s; for(int i = 0; i < strlen(s); i++) c[i] += k; return c; } ,這似乎看起來像它應該工作,但事實並非如此。運行程序時會引