[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Programming question: sizeof struct?



On Fri, Jul 09, 1999 at 09:44:06AM -0600, Jason Gunthorpe wrote:
> > > struct foo {
> > >     char text[3];
> > >     int  num;
> > > };
> > > 
> > > sizeof would return 6 and not 5.  
> > 
> > 6? Are you sure you're using Linux/gcc?
> 
> Yes, 6, it will insert a single extra character at the end of text to
> place the alignment of num on a 4 byte boundry.

Or even 8, since an int is 32 bits.


Hamish
-- 
Hamish Moffatt VK3SB (ex-VK3TYD). 
CCs of replies from mailing lists are welcome.


Reply to: