84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
下面是关于二叉树的代码----pos代表了根据前序遍历pre_str确定了根节点在中序遍历中的位置.
pos
pre_str
int pos = strchr(in_str, pre_str[0]) - in_str;
我知道指针就是代表地址的一个unsigned int, 我想问的是这样直接用指针加减来得到的位置为什么不考虑到sizeof(int), 是说这些指针都是和数据类型的size无关的吗? 有错误的话请大家指正下.
unsigned int
sizeof(int)
size
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
The offset is already included in the addition and subtraction of pointers. For example, if the pointer of int* is added to n, its memory address is added to n*sizeof(int). It is not directly added or subtracted according to the memory address.
The offset is already included in the addition and subtraction of pointers. For example, if the pointer of int* is added to n, its memory address is added to n*sizeof(int). It is not directly added or subtracted according to the memory address.