tags:

views:

83

answers:

3

What does the following mean in C++?

typedef PComplex RComplex [100];

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

Thanks

A: 

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

Preet Sangha
+9  A: 

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.

UncleBens
I would use the term "Type Alias" rather than synonym. But essentially correct.
Martin York
+2  A: 

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;
Roger Pate