char 数组 = char 数组的问题 [英] problems with char array = char array
本文介绍了char 数组 = char 数组的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有:
char message1[100];
char message2[100];
当我尝试执行 message1 = message2
时,出现错误:
When I try to do message1 = message2
, I get error:
从类型 'char *'
我有类似的功能
if(send(clntSocket, echoBuffer, recvMsgSize, 0) != recvMsgSize){
DieWithError("send() failed")
}
介于两者之间.这些事情会以某种方式搞砸吗?:(
inbetween. Could these mess things up somehow? :(
我有一种感觉,也许你不能对 char 数组或其他东西执行 =
,但我环顾四周,找不到任何东西.
I have a feeling maybe you can't do =
on char arrays or something, but I looked around and couldn't find anything.
推荐答案
你的怀疑是正确的.C(我假设这是 C)将数组变量视为指针.
Your suspicions are correct. C (I'm assuming this is C) treats an array variable as a pointer.
您需要阅读有关数组和指针的 C 常见问题解答:http://c-faq.com/aryptr/index.html
You need to read the C FAQ about arrays and pointers: http://c-faq.com/aryptr/index.html
这篇关于char 数组 = char 数组的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文