Bi.
Bi.

Reputation: 1906

What is the meaning of a typedef declaration with [100] at the end?

What does the following mean in C++?

typedef PComplex RComplex [100];

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

Upvotes: 0

Views: 197

Answers (3)

Roger Pate
Roger Pate

Reputation:

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;

Upvotes: 2

UncleBens
UncleBens

Reputation: 41331

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.

Upvotes: 9

Preet Sangha
Preet Sangha

Reputation: 65476

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

Upvotes: -1

Related Questions