Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!think!ames!ptsfa!ihnp4!ihuxz!burris From: burris@ihuxz.UUCP Newsgroups: comp.sys.atari.st Subject: Re: sizeof("string") Message-ID: <2011@ihuxz.ATT.COM> Date: Wed, 15-Apr-87 08:54:45 EST Article-I.D.: ihuxz.2011 Posted: Wed Apr 15 08:54:45 1987 Date-Received: Fri, 17-Apr-87 03:25:38 EST References: <8704120143.AA11235@cory.Berkeley.EDU> <2006@ihuxz.ATT.COM> <1765@trwrb.UUCP> Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 31 Summary: I stand corrected. In article <1765@trwrb.UUCP>, sansom@trwrb.UUCP (Richard Sansom) writes: > (This is getting out of hand) - I just ran your program on our 4.2 BSD > system and came up with the following results: > > 20 > 4 > 6 > char string[ 20 ]; char *strpt = "hello"; main() { printf( "%d\n", sizeof( string ) ); printf( "%d\n", sizeof( strpt ) ); printf( "%d\n", sizeof( "hello" ) ); } I stand corrected. This is the correct answer, providing that your machine has a pointer size of 4 bytes. Evidently the compiler allocates the fixed string as: char string[ 6 ]; Sorry for the confusion. If I had the time to actually try the program I posted I would have seen that the answer was wrong. Dave Burris ihnp4!ihuxz!burris