🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4590

int's and zero

#4590
From: Eivind Eklund
Date: Tue, 09 Jan 1996 10:47
20 lines
872 bytes
Are zero in an integer required to be represented by binary zeros?
I know it is not required for floats and pointers, so memset()ing a 
structure to 8-bit zeros are not correct if it contain pointers or 
floating point values, but what about integers? Ie, if I have

struct intstruct {
  int a;
  long b;
  short c;
};
..
struct intstruct teststruct;
memset(&teststruct, 0, sizeof(teststruct));

Is teststruct.a, teststruct.b, and teststruct.c guaranteed to be == 0?

-- 
Eivind Eklund
eivind.eklund@funcom.com
FUNCOM don't speak for me, and I return the courtesy.
Technical Details
Message-ID: <4cth4e$4q@odin.funcom.no>
Path: arc1-ca.pugleaf.net!funcom.no!news

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!funcom.no!news
From: eivind@odin.funcom.com (Eivind Eklund)
Newsgroups: comp.std.c
Subject: int's and zero
Date: 9 Jan 1996 10:47:42 GMT
Organization: Funcom Productions.
Message-ID: <4cth4e$4q@odin.funcom.no>
NNTP-Posting-Host: odin.funcom.no
X-Newsreader: knews 0.9.3