Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!iconsys!caeco!fsf From: fsf@kasparov.scs.com (Rick Farnbach) Newsgroups: comp.lang.c Subject: A "How to typedef..." Question Message-ID: Date: 7 Aug 90 02:25:18 GMT Sender: Unknown@caeco.UUCP Distribution: comp Organization: none Lines: 40 How does one create a type, using typedef, that is defined to be a pointer to a pointer to a pointer... ad infinitum? The straight-forward approach is: typedef tree *tree[2]; /* binary tree, for example */ Which is, of course, grossly illegal. What I would like to be able to do is write lines such as: tree t; t[0] = malloc(sizeof(tree)); t[0][1] = malloc(sizeof(tree)); . . . The closest I have been able to do is: typedef struct _tree { struct _tree *t; } tree[2]; tree t; t[0].t = malloc(sizeof(tree)); t[0].t[1].t = malloc(sizeof(tree)); . . . Which is *not* what I am after. Just to pique interest, I add that PASCAL (blech) *allows* this construct. How can this be done in C? Thanks, Rick NOTE: Please do not waste bandwidth telling the whole network that *you* can't see any reason for wanting to do this. If you don't have an answer then keep your (computer) shut!