Article View: comp.sys.atari.st
Article #26325Re: sizeof and strings
From: pvf
Date: Mon, 13 Apr 1987 19:36
Date: Mon, 13 Apr 1987 19:36
11 lines
1176 bytes
1176 bytes
According to K&R, p188, first paragraph:
"When applied to an array, the result is the total number
of bytes in the array."
This calls out a deviation (for the purpose of sizeof) from the normal
interpretation of an array name (or literal string) as a pointer
to the object. The deviation is specifically so that sizeof() is useful
for determining the size of the storage for an array.
This calls for "sizeof("1234567890")" to be 11. This is in fact the
value returned by both the Berkeley 4.2 and Sun C compilers.
Technical Details
Message-ID:
<389@bridge2.bridge>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!genrad!decvax!decwrl!pyramid!nsc!csi!epimass!pesnta!altos86!elxsi!bridge2!pvfReferences:
<639@batcomputer.tn.cornell.edu> <821@viper.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!genrad!decvax!decwrl!pyramid!nsc!csi!epimass!pesnta!altos86!elxsi!bridge2!pvf From: pvf@bridge2.UUCP Newsgroups: comp.sys.atari.st Subject: Re: sizeof and strings Message-ID: <389@bridge2.bridge> Date: Mon, 13-Apr-87 14:36:04 EST Article-I.D.: bridge2.389 Posted: Mon Apr 13 14:36:04 1987 Date-Received: Fri, 17-Apr-87 05:35:38 EST References: <639@batcomputer.tn.cornell.edu> <821@viper.UUCP> Reply-To: pvf@bridge2.bridge (Paul V. Fries) Organization: Bridge Communications Lines: 11 Keywords: user-friendly C sizeof