Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbosgd!gatech!seismo!brl-tgr!gwyn From: gwyn@brl-tgr.ARPA (Doug Gwyn ) Newsgroups: net.unix-wizards Subject: Re: Need help with C Message-ID: <2117@brl-tgr.ARPA> Date: Fri, 31-Jan-86 17:33:03 EST Article-I.D.: brl-tgr.2117 Posted: Fri Jan 31 17:33:03 1986 Date-Received: Mon, 3-Feb-86 05:20:01 EST References: <9294@ritcv.UUCP> Organization: Ballistic Research Lab Lines: 39 > I'm having some problems with structures in a C program I've been > writing. I have a structure declared as follows: > > struct datestruct > { > char month, day, year; > } > > Further on I have a structure declared: > > struct dbstruct > { > double ... > struct datestruct date; > } > > and the declarations: > > struct datestruct date; > struct dbstruct dbase[63]; > > I try to do a comparison between these, i.e. > > ( date == dbase[loop].date ) > > but the compiler blows up on this, saying the two are incompatible. > I'm almost positive I've done this sort of thing before, and can't > seem to find why it won't work. Anyone have any ideas/suggestions > as to why this is? Struct comparison is not supported by C, just assignment, passing or returning to/from functions, and member selection. You will have to compare the three elements individually (or use memcmp(3C)). > Also, is there a better newsgroup for these type of inquiries? net.lang.c (INFO-C)