TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALEXANDRE OSTANINE
from: BALOG PAL
date: 1997-04-14 06:15:00
subject: typedef

                           Hi, Alexandre Ostanine!
On 10 Apr 97  09:03:07 you wrote to Balog Pal
 AO> typedef struct {
 AO> int a;
 AO> }mystruct;
  BP> struct mystruct { int a; };
 BP> It's automatically a type. And you can use mystruct * right
 BP> inside the {} if you like.
 AO> Right ! But if you use typedef keyword - your structure will have a
 AO> synonym wich you can use to redefine same structure with a different
 AO> name , and next time you can declare it as:
 AO> mystruct p;
 AO> mystruct *a;
 AO> instead of
 AO> struct mystruct p;
 AO> struct mystruct *a;
All these `struct'-s are needed _only_ in plain C. In C++ you can simply
write the upper lines along with the declaration at BP>.  As I stated before,
any struct or class name is automatically a typedef too.
Paul
... Old MacDonald had a computer, with EIA I/O...
--- OS/2 Warp
---------------
* Origin: The FlintStones' Cave in BedRock (2:371/20)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.