From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Cross Message-Id: <200107061441.KAA25020@augusta.math.psu.edu> To: 9fans@cse.psu.edu Subject: Re: [9fans] thread In-Reply-To: <20010706042502.AE409199D7@mail.cse.psu.edu> Cc: Date: Fri, 6 Jul 2001 10:41:11 -0400 Topicbox-Message-UUID: c34bbfb4-eac9-11e9-9e20-41e7f4b1d025 In article <20010706042502.AE409199D7@mail.cse.psu.edu> you write: >Thank you, Dan, Thanks, Kenji, though I think that Dennis' note was better. :-) #include >#include >main(){ > int a[1]; > a[0] = 10; > print("%d\n",*a); > print("%d\n",a); > print("%d\n",&a); > print("%d\n",*&a); > print("%d\n",*(&a)); These are the two that confused me, since they output: >2147479448 >2147479448 However, Dennis clarified how it worked when he pointed out the type differences between a and &a (the former is int *, the latter int (*)[1]). I believe that in the case of *&a, you end up with a variable of type a[1], which decays into int *. Restated another way, it's as if the * and & cancel each other out, leaving you an unadorned a, which turns into int *. At least, I believe that's how it works; I'd love to be corrected if I'm wrong. Since this isn't comp.lang.c, I can actually look forward to such a thing. ;-p - Dan C.