From owner-freebsd-questions Sun Mar 14 14:18:19 1999 Delivered-To: freebsd-questions@freebsd.org Received: from cserv.oksys.bg (ppp12.bulinfo.net [195.10.36.109]) by hub.freebsd.org (Postfix) with ESMTP id C4D2315063 for ; Sun, 14 Mar 1999 14:15:55 -0800 (PST) (envelope-from ian@bulinfo.net) Received: from bulinfo.net (localhost [127.0.0.1]) by cserv.oksys.bg (8.9.2/8.9.2) with ESMTP id AAA12235; Mon, 15 Mar 1999 00:14:24 +0200 (EET) (envelope-from ian@bulinfo.net) Message-ID: <36EC34C0.13D218B4@bulinfo.net> Date: Mon, 15 Mar 1999 00:14:24 +0200 From: Iani Brankov Organization: ok systems X-Mailer: Mozilla 4.51 [en] (X11; I; FreeBSD 3.1-STABLE i386) X-Accept-Language: en MIME-Version: 1.0 To: Mark Turpin Cc: Freebsd-questions Subject: Re: Programming Question References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Mark Turpin wrote: > > I feel really silly having to ask this. > > Why does my sizeof(mystruct) come out as 4 instead of 3 ( short + char ) ? > > struct { > short shortvariable; > char charvariable; > } mystruct; > > sizeof(mystruct) == 4 Try finding the addresses of the structure members. As I know the compiler aligns every variable at even address. Maybe that's the reason. --iani To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message