Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!uflorida!beach.cis.ufl.edu!thoth From: thoth@beach.cis.ufl.edu (Robert Forsman) Newsgroups: comp.lang.c Subject: Re: Why are character arrays special (equal rights for structs) Message-ID: <19796@uflorida.cis.ufl.EDU> Date: 19 Feb 89 02:31:17 GMT References: <19742@uflorida.cis.ufl.EDU> <28700034@mcdurb> Sender: news@uflorida.cis.ufl.EDU Reply-To: thoth@beach.cis.ufl.edu () Organization: UF CIS Department Lines: 40 Excuse me, but I think my original topic has been corrupted (note I fixed the subject line). OK, I learned how to use an array on the fly. if (intcmp(command,(int[]){GET,TORCH,0})==0) { ... Cool, but it isn't in ANSI (pat on the back to GNU though). Now here's one that I'm sure will blow your socks off. { int a,b; scanf("%d %d",&a,&b); if (intcmp(command,(int[]){a,b,0})==0) { ... What a nifty new razorblade! You have an array out in writeable data space ready to accept any values and the code writes in a, b and 0 just before it needs them. I'd like to see this added. Really it would just be a compression of { int a,b,goober[3]; scanf("%d %d",&a,&b); goober[0] = a; goober[1] = b; goober[2] = 0; /* should be unnecessary up above, since it's always 0 */ if (intcmp(command,goober)==0) { ... Anyone want to lobby to include it? As far as corrupting my topic goes, how did we get from array declaration on the fly to token parsing (I only look at the subject line when I'm junking a series of stupid postings or intelligent questions outside my sphere of interest.)? I'm curious. /* of course it's my own opinion, did you see someone else post it? */ Just say maybe to .signature