小编Tot*_*tie的帖子

调试指针算术

当我打印变量地址之间的差异时,我无法解决为什么我找到差异

这是代码:

int main()
{

        int *a,b = 5,e = 0;
        int *c,d = 10,f = 0;
        long t1,t2;
        a = &b;
        c = &d;
        e = &b;
        f = &d;
        t1 = e - f;
        t2 = a - c;
       printf("\n Address of b using a: %x \t %d using e : %x \t %d value of b : %d",a,a,e,e,b);
       printf("\n Address of d using c: %x \t %d using f : %x \t %d value of d : …
Run Code Online (Sandbox Code Playgroud)

c pointers

0
推荐指数
1
解决办法
448
查看次数

结构成员语法

我无法访问结构的成员

代码如下:

int main()
{

      typedef struct tempA
       {
         int a;
        }tempa;


      typedef struct tempB
      {
        tempa **tA;
       }tempb;

     tempb.(*tA)->a =5;
     printf("\n Value of a : %d",tempb.(*tA)->a);

}
Run Code Online (Sandbox Code Playgroud)

我试图使用它来访问它, tempb.(*tA)->a;但我收到语法错误:

error: expected identifier before ‘(’ token 
Run Code Online (Sandbox Code Playgroud)

访问的正确语法是int a什么?

提前致谢

c syntax struct pointers

0
推荐指数
1
解决办法
185
查看次数

标签 统计

c ×2

pointers ×2

struct ×1

syntax ×1