开发者

C++ typedef meaning

开发者 https://www.devze.com 2022-12-13 12:26 出处:网络
What does the following mean in C++? ty开发者_StackOverflow社区pedef PComplex RComplex [100]; Note, PComplex is a user-defined type in my code.

What does the following mean in C++?

ty开发者_StackOverflow社区pedef 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;


The declares a type synonym called PComplex which is actually an array of 100 RComplex items.

0

精彩评论

暂无评论...
验证码 换一张
取 消