c语言 strcpy
来源:百度知道 编辑:UC知道 时间:2024/06/08 23:44:18
struct list
{char name[5];}list;
void performance(char a)
{strcpy(list.name,a);printf("%c",list。name[5]);}
main()
{char a;
perform(a);
}
如何把主函数中的字符a 通过调用函数perform 使得list.name 是a
如何修改 帮我写个正确的完整的 谢谢
{char name[5];}list;
void performance(char a)
{strcpy(list.name,a);printf("%c",list。name[5]);}
main()
{char a;
perform(a);
}
如何把主函数中的字符a 通过调用函数perform 使得list.name 是a
如何修改 帮我写个正确的完整的 谢谢
首先,a是字符,name是字符串,二者不匹配。
1.a也为字符串。那么可以这么写
#include<string.h>
struct list
{
char name[5];
}list;
void perform(char a[3])
{
strcpy(list.name,a);
printf("%s",list.name);
}
main()
{
char a[]="cba";
perform(a);
}
2.name是字符的话,可以这么写
#include<string.h>
struct list
{
char name;
}list;
void perform(char a[3])
{
list.name=a;
printf("%c",list.name);
}
main()
{
char a='c';
perform(a);
}
#include<iostream>
#include<string>
using namespace std;
struct list
{char name[5];}list;
void performance(char *a)
{strcpy(list.name,a);//printf("%c",list.name);
cout<<list.name<<endl;
}
void main()
{char *a="112";
performance(a);
}
#include<stdio.h>
#include<string.h&
c语言strcpy()用法
c语言strcpy命令
高手进来看看这个程序(c语言的)strcpy()
C语言编程:用自定义函数实现字符串处理函数strcat、 strcpy、strcmp、strlen和
C语言,编写一个程序,用于完成字符数组的复制操作,相当于函数strcpy( )
编C语言程序:用自定义函数实现字符串处理函数strcat、 strcpy、strcmp、strlen和strlwr的功能
C/C++:memmove、memcpy、strcpy三者的区别?
C的memcpy和strcpy的区别是什么?
strcpy(G.vexs[9].name,"宿舍楼"); 怎么转换成C++语言的
关于strcpy?