Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: off topic: clearing structures in C

Author: Tom Kerrigan

Date: 14:48:58 04/18/00

Go up one level in this thread


On April 18, 2000 at 17:01:07, John Coffey wrote:

>I am using Borland C/C++ 5.5.  If I assign a zero to a structure, will that
>clear the entire structure?  i.e. mystruct = 0;
>
>Sorry about the off topic discussion.
>
>John Coffey

Depending on the size of the structure and your compiler and some other factors,
you can either do:

memset(mystruct, 0, sizeof(mystruct))

or set all the fields of the structure to 0 individually. Actually, both methods
will get the job done, but one will be faster than the other.

-Tom



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.