Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!srcsip!gendibal!pclark From: pclark@SRC.Honeywell.COM (Peter Clark) Newsgroups: comp.lang.c Subject: Re: typedef-ing an array Message-ID: <78633@srcsip.UUCP> Date: 28 Jun 90 23:41:11 GMT References: <78627@srcsip.UUCP> Sender: news@src.honeywell.COM Lines: 28 In-reply-to: pclark@SRC.Honeywell.COM's message of 28 Jun 90 22:36:11 GMT I wrote: >Is there anyway to typedef an array (of a specific length)? Obviously, the >above declaration doesn't do it, or I wouldn't be asking. If the typedef >mechanism isn't sufficient (I don't think it is), how can this be done? which wasn't specific enough. What I meant was, why doesn't this work: ----------------------------------------- #include typedef char foo[29]; /* a string with 28 chars, add one for the NULL byte */ foo bar = "Hello World, this is my test"; void main() { bar = "Silly old me"; printf("%s\n",bar); } -------------------------------------------------- The initializer works fine, but the assignment inside main() doesn't. Pete Clark