与字符数组=字符数组的问题 [英] problems with char array = char array
本文介绍了与字符数组=字符数组的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有:
char message1[100];
char message2[100];
当我尝试做 MESSAGE1 = MESSAGE2
,我得到错误:
When I try to do message1 = message2
, I get error:
不兼容的类型'的char [100]
从类型'的char *'
我有一个像
if(send(clntSocket, echoBuffer, recvMsgSize, 0) != recvMsgSize){
DieWithError("send() failed")
}
插图中。可以将这些搞搞不知何故? (
inbetween. Could these mess things up somehow? :(
我有一种感觉,也许你做不到 =
的字符数组或东西,但我环顾四周,找不到任何东西。
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
这篇关于与字符数组=字符数组的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文