From: Elliott Oti Newsgroups: comp.os.msdos.djgpp Subject: Q: Typedef riddle Date: Sat, 16 Nov 1996 06:44:01 -0800 Organization: Academic Computer Centre Utrecht, (ACCU) Lines: 40 Message-ID: <328DD331.26E4@stud.warande.ruu.nl> NNTP-Posting-Host: warande1078.warande.ruu.nl Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Hi, I've been programming in C for a couple of years now and I thought I knew at least the basics pretty well, but this has me stumped. Why does the following short little program output 10 It's also 10 10 10 instead of 10 10 10 It's also 10 10 10 It's not a gcc bug because Borland gives a similar output, but -Wall gives absolutely no warnings. So what's wrong? TIA, Elliott --------------------- SNIP ------------------------------------------ #include typedef int thing[3]; void Dump(thing *V) { printf("\n%i %i %i\n",*V[0],*V[1],*V[2]); } int main(void) { thing V; V[0] = V[1] = V[2] = 10; Dump(&V); printf("\nIt's also %i %i %i\n",V[0],V[1],V[2]); return 0; } -------------------------------------------------------------------