Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Help ! pointer to struct

Author: Alessandro Scotti

Date: 01:20:05 01/12/05

Go up one level in this thread


On January 12, 2005 at 02:33:31, rasjid chan wrote:

>Excuse me as I only have a hazy understanding of C semantics.
>
>I have struct {....} PC piece[2][16];
>
>The following bug is from the debugger Visual C++ 4.0
>
>&piece[0][0]	0x0054d030
>&piece[0][0]+16	0x0054d370
>piece	        0x0054d030
>piece+16	0x00550430
>
>Why is that pointer arithmetic don't seem to be correct -
>piece+16 != &piece[0][0]+16.

It's not a bug. Rather, piece and &piece[0][0] are pointers to different types:
- &piece[0][0] is a pointer to PC;
- piece is a pointer to PC[16].



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.