**strings和*(*strings)的区别

sunying522 2011-11-10 02:34:21
#include <stdio.h>
#include <assert.h>

#define TRUE 1
#define FALSE 0

int
find_char(char **strings,int value)
{
assert(string!=NULL);
while(*string!=NULL){
while(**strings!='0'){
if(*(*strings)++==value)
return TURE;
}
strings++;
}
return FALSE;
}
用这个来测试当前的字符是否与需要查找的字符匹配,第一个**string是间接访问操作访问列表中的当前指针,*(*string)是间接访问操作作用股原先那个值得拷贝上???这句话真的不懂诶,求大神解释~~~谢谢谢谢!!!
...全文
220 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
AnYidan 2011-11-10
  • 打赏
  • 举报
回复
如果你知道 * 的Associativity是right to left,你就明白了
赵4老师 2011-11-10
  • 打赏
  • 举报
回复
VC调试(TC或BC用TD调试)时按Alt+8、Alt+6和Alt+5,打开汇编窗口、内存窗口和寄存器窗口看每句C对应的汇编、单步执行并观察相应内存和寄存器变化,这样过一遍不就啥都明白了吗。
(Linux或Unix下可以在用GDB调试时,看每句C对应的汇编并单步执行观察相应内存和寄存器变化。)

不要迷信书、考题、老师、回帖;
要迷信CPU、编译器、调试器、运行结果。
并请结合“盲人摸太阳”和“驾船出海时一定只带一个指南针。”加以理解。
赵4老师 2011-11-10
  • 打赏
  • 举报
回复
Operator Precedence and Associativity
The table below lists the C and C++ operators and their precedence and associativity values. The highest precedence level is at the top of the table.

Symbol Name or Meaning Associativity
Highest Precedence
++ Post-increment Left to right
-- Post-decrement
( ) Function call
[ ] Array element
-> Pointer to structure member
. Structure or union member
++ Pre-increment Right to left
-- Pre-decrement
! Logical NOT
~ Bitwise NOT
- Unary minus
+ Unary plus
& Address
* Indirection
sizeof Size in bytes
new Allocate program memory
delete Deallocate program memory
(type) Type cast [for example, (float) i]
.* Pointer to member (objects) Left to right
->* Pointer to member (pointers)
* Multiply Left to right
/ Divide
% Remainder
+ Add Left to right
- Subtract
<< Left shift Left to right
>> Right shift
< Less than Left to right
<= Less than or equal to
> Greater than
>= Greater than or equal to
== Equal Left to right
!= Not equal
& Bitwise AND Left to right
^ Bitwise exclusive OR Left to right
| Bitwise OR Left to right
&& Logical AND Left to right
|| Logical OR Left to right
? : Conditional Right to left
= Assignment Right to left
*=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |= Compound assignment
, Comma Left to right
Lowest Precedence

一鸣惊人 2011-11-10
  • 打赏
  • 举报
回复
运算符的问题
七擒关羽 2011-11-10
  • 打赏
  • 举报
回复
*p++与*(p++)
pengzhixi 2011-11-10
  • 打赏
  • 举报
回复
char **string;
char *s1="hello";
char *s2="world";

string[1]=s1;
string[2]=s2;

那么**string++ ==>**(string++) 也就是说string++;返回的是自增前的值 就是说 string++还是指向s1 **(string++)就是返回字符'h',但是string已经指向了s2了。

对于*(*string)++ ==》*(string[0])++ 也就是说 应该是 *s1++; s1本来是指向字符'h'的 ++之后指向了'e'但是 s1++还是返回s1自增前的指向,那么*s1++得到就是字符'h'
luciferisnotsatan 2011-11-10
  • 打赏
  • 举报
回复
**strings++等于**(string++)
*(*strings)++等于*((*strings)++)

运算符结合律
Gloveing 2011-11-10
  • 打赏
  • 举报
回复
**strings和*(*strings) 没有差别

69,336

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧