strcat

    -2热度

    2回答

    当我运行这段代码时,我总是在我的IDE中发现一个问题。你可以给这个解决方案吗? #include<stdio.h> #include<string.h> int main(void) { char cname[4]="mahe"; strcat(cname, "Karim"); printf("%s",cname); get

    1热度

    1回答

    我想连接两个字符串,所以我可以获得文件路径。不过,我在Valgrind的接收错误 条件跳转或移动依赖于未初始化的值(一个或多个) 我的代码: /** * @brief Concatenate two strings to get file path * @param firstP - First string * @param secondP - Second string * @retu

    -1热度

    1回答

    这是我的计划: #include <stdio.h> char *ft_strcat(char *dest, char *src) { int i; int k; i = 0; k = 0; while (dest[i]) i++; while (src[k]) { dest[i + k] = s

    0热度

    1回答

    我试图不断地将char添加到字符串的末尾。我通过运行该这样做我的主 char String[256]; char alphabets[26] = "abcdefghijklmnopqrstuvxyz"; for (int i = 0; i < 257; i++) { char newChar = alphabets[indexOfNewChar-1]; print

    0热度

    1回答

    我对c编程非常陌生,对于学校作业,我需要编写一个程序以字符串作为输入并将字母“ay”添加到每个词都以这个单词前面的辅音开头。据暗示,这应该用strncpy和strcat来完成。 这是我写的代码: #include <stdio.h> #include <string.h> int main() { char myString[50]; cha

    -1热度

    1回答

    我基本上只是采取一个字符串和追加/ concatting与另一个字符串。第一次运行会产生所需的结果,但第二次,第三次等结果似乎是src字符串的两倍。将事情与jQuery结合起来非常简单,不知道C中发生了什么。我应该使用memset吗?或calloc? #include <stdio.h> #include <string.h> int main(void) { const char

    -1热度

    1回答

    我怎么能解释这一点:var_ptr_char +的strlen(var_ptr_char) 在后续一段C代码: #define INT_CONSTANT 80 char var_ptr_char[1024]; strcat(var_ptr_char,"SOMETHING"); sprintf(var_ptr_char+strlen(var_ptr_char),":%d",INT_CONSTA

    0热度

    2回答

    我是C语言的新手。我试图使用strcat函数。 #include <stdio.h> #include <string.h> int main(int argc, const char *argv[]) { char s1[] = "12345"; char s2[] = "abcde"; strcat(s1, s2); puts(s1);

    -2热度

    2回答

    helloeveryone。我对编程相当陌生,目前正努力学习C编程,以便在我的任何项目中进一步发展。我刚刚学会了如何使用malloc和realloc,并且在尝试使用strcat将多维数组中的两个给定字符串组合在一起之前似乎都很好。 我应该得到一个基于用户输入两个字符串的组合,和奇怪的是,第一个字符是丢失或其它字符替换... 我会包括源代码,以及下方的输出。我非常感谢你的帮助。提前致谢!! (不介意

    0热度

    2回答

    我试图编写一个程序,该程序需要用户输入两次,然后连接结果,但我遇到了问题。 我的预期输出是: What would you like your message to be? input message received: input What would you like your message to be? words message received: words new mes