简体   繁体   中英

C++ typedef meaning

What does the following mean in C++?

typedef PComplex RComplex [100];

Note, PComplex is a user-defined type in my code.

Thanks

RComplex is a synonym for PComplex[100] . Typedefs have a similar syntax to variable declarations, except in place of a variable name you get a typename.

This aliases RComplex to the type "array (of length 100) of PComplex", also known as PComplex[100] . The following two variable declarations give each the same type: (after the above typedef)

PComplex a[100];
RComplex b;

声明了一个称为PComplex的类型同义词,它实际上是100个RComplex项的数组。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM