cost 91 ms
兩個字符串之間的重疊驗證問題

[英]Problem of overlap verification between two strings

我目前正在從標准 C 庫重新編碼srtcat()並且我已經設置了一些檢查以避免重疊問題。 問題是我的程序還是進入了錯誤處理。 這是代碼:char *my_strcat(char *restrict dest, const char *restrict src) { size_t dest_l ...

我嘗試創建一個 function 以使用指針將 str2 連接到 str1,但它沒有像我預期的那樣工作

[英]I tried creating a function to concatinate str2 to str1 using pointers but it doesn't work as I am expecting

我正在使用 C 中的指針制作一個strcat ,但是我在我的while循環中遇到了以下問題。 這是我的代碼,無法將 str2(此處為t )添加到 str1(此處為s ):char *pstrcat(char *s,char *t) { char *start=s; while(*s+ ...

如何將一個字符連接成一個字符串?

[英]How do I concat a character into a string?

我正在嘗試獲取一個字符並將其添加到一個字符串中。 或者如果那不可能,將它添加到字符數組中? 我嘗試將 'string updated = ""' 更改為 'char updated[text_length]' 但我遇到了同樣的錯誤 - 不兼容 integer 到指針轉換錯誤 ...

這在 C 中使用不安全嗎?

[英]Is this unsafe to use in C?

您好,我遇到了一個問題。 我對 C 不是很有經驗。 我正在嘗試將一個字符連接到我的路徑變量。 但是當我運行這行代碼時,我的另一個字符串變量被“覆蓋”或者之后表現得很奇怪。 注釋掉后一切正常。 我不想在這里發布整個代碼我只是想知道這一行是否運行起來不安全。 我也試過: //編輯我實際上嘗試了 st ...

Itoa 阻止 strcat 正確附加

[英]Itoa stopping strcat from properly appending

我正在嘗試 append Arduino ZF6F87C9FDCF8B3C3F07F93F1EE8712 中的一系列字符 arrays 我有一個字符數組“outputString”,以及一系列其他字符 arrays,我通過 strcat 與 append 一起使用。 我還有一個生成校驗和的校驗和生成 ...

為什么 strcat 在 function 內不起作用?

[英]why does strcat not work inside function?

嗨,我正在嘗試編寫一個 function 得到 3 個單詞,將它們連接到一個單詞並反向打印單詞。 我無法將連接的單詞放入 concatWords function 中的 ptr w1 中。 另一個問題 - 我應該在每個單詞的末尾加上 '\0' 嗎? 有人可以查看我的代碼嗎? 謝謝! ...

從 'char *' 對 'char' 的賦值使指針從沒有強制轉換的整數 [-Wint-conversion]

[英]assignment to ‘char’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]

我試圖在輸入 a 時將 largeVal 與 smallVal 連接起來,並將結果存儲到arr[]數組中。 錯誤消息如下: 警告:從 'char *' 分配給 'char' 使指針從沒有強制轉換的整數 [-Wint-conversion] 我應該如何解決這個問題? ...

Strcat 正在循環更改我的變量

[英]Strcat is making my variable in loop change

我想出了一個嚴重的問題。 當我在以下 C 代碼中使用strcat時, r的值會發生變化,並且循環會運行意外次數。 我無法弄清楚發生了什么。 我已經發布了帶有相應輸出的代碼。 使用的strcat : #include <stdio.h> #include <string.h> ...

我正在嘗試在 c 中實現拆分,我不知道為什么我的代碼在他執行 strcat 時會崩潰

[英]i am trying to implemet split in c , i doesnt know why the my code get crashed when he do strcat

// cell 表示要返回的數組中的單元格 在將下一個字符添加到單元格之前增加單元格的大小每個未簽名的字符為 8 位 *** 再寫一遍后,我的 strcat 也有同樣的問題,有人能解釋一下我的錯誤嗎?*** ...

Function strtok() 不適用於 strcat()(非法硬件指令)

[英]Function strtok() does not work with strcat() (illegal hardware instruction)

我是c的新手,我正在編寫一個腳本,將文件路徑輸入為 arguments。 我想要路徑的最后一個元素和路徑的rest 。 這是我寫的:#include <stdio.h> #include <stdlib.h> #include <string.h> int m ...

strcat 如何不覆蓋下一個變量?

[英]How does strcat not overwrite the next variable?

char str[] = "some short string"; int a = 20; strcat(str, "a very very long string"); printf("%d\n", a); // prints 20 如果我理解正確, a將添加到str正上方的堆棧中。 但這應該 ...

不能 C 中的 append 字符串(程序停止)

[英]cannot append string in C (program stops)

我正在嘗試 append 一個字符串,但是每當它到達strcat() function 時,程序就會退出而不打印字符串。 我一直在 Visual Studio 中及其 own.exe 文件中運行此代碼,並獲得相同的結果。 誰能告訴我我做錯了什么? ...

為什么 strcat_s 導致問題

[英]why strcat_s causing problems

我遇到的問題是我得到隨機字符 output 而不是將名字、中間名和姓氏組合起來,這是程序的目的,當我運行調試器時它說問題在 strcat_s 但我不知道是什么問題用它 ...

2022-05-18 07:27:44   2   135    c++ / strcat  
做<cstring>不包括 strcat_s() 函數?

[英]Does <cstring> not include the strcat_s() function?

我的代碼是這樣的: #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;cstring&gt; using namespace std; const int LENGTH1 = 25; char array_str1[LE ...

使用 strcat() 時跟蹤陷阱

[英]Trace trap when using strcat()

我目前正在 C 學習編程,我不明白為什么我的終端在運行我的代碼時輸出:“zsh: trace trap./a.out”。 這是我的代碼: 這是我在終端輸入的內容: ...

在 C 中實施 strcat 時的奇怪行為

[英]Strange behaviour when implementing strcat in C

我正在嘗試自己實施 strcat function。 這是我的代碼: 然而,當我嘗試測試這個 function 時,我只得到了 src 字符串。 (即我期望得到dst+src,但是返回值和src一樣) 從代碼中我們可以看出,在第一個 while 循環中,我試圖將 tmp 指針移動到 dst 的末尾 ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM