typedef int *a,*b,*c
时间: 2023-05-29 17:05:48 浏览: 59
This code defines three pointers to integers, named `a`, `b`, and `c`.
It is equivalent to writing:
```
typedef int *a;
typedef int *b;
typedef int *c;
```
This allows you to declare variables of type `a`, `b`, or `c` as pointers to integers. For example:
```
a ptr1;
b ptr2;
c ptr3;
```
All three of these variables would be pointers to integers.
相关问题
typedef int* sh;sh a,b;中的b是什么类型,为什么
在 `typedef int* sh; sh a, b;` 这个语句中,`b` 是一个 `int*` 类型的变量。
首先,我们来解析 `typedef int* sh;` 这个语句。`typedef` 关键字用于为已有的类型创建一个新的类型名。在这里,`sh` 被定义为 `int*` 类型的新类型名。
接下来,我们继续解析 `sh a, b;` 这个语句。根据前面的定义,`sh` 等价于 `int*`。所以,这个语句可以理解为 `int* a, b;`。
根据 C 语言声明语句的结构是从右向左解析的原则,我们可以逐步分析这个声明语句:
1. 首先,从右向左,`b` 是一个变量,没有任何修饰符,所以它是一个普通的 `int*` 类型的变量,即指向 `int` 类型的指针。
2. 接下来,我们继续往左,`a` 也是一个变量,但是它是由 `sh` 定义的,即 `int*` 类型的变量。
综上所述,在 `typedef int* sh; sh a, b;` 这个语句中,`b` 是一个指向 `int` 类型的指针变量。而 `a` 也是一个指向 `int` 类型的指针变量,因为 `a` 是由 `sh` 定义的,而 `sh` 在这里等价于 `int*`。
#define T1 int* tepydef int* T2 T1 a, b; T2 c, d;
这段代码中,声明了两个指向int类型的指针a和b,以及一个指向指向int类型的指针的指针c和一个指向int类型的指针的指针d。需要注意的是,这段代码中的宏定义存在一个错误,应该将tepy改为typedef。正确的代码应该是:
typedef int* T1;
typedef int** T2;
T1 a, b;
T2 c, d;