From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: Pointer problems!! Date: Mon, 26 Jan 1998 07:16:26 -0500 Organization: Cornell University (http://www.cornell.edu/) Lines: 55 Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <34CC7E9A.6D594934@cornell.edu> References: <199801260544 DOT SAA12728 AT cirrostratus DOT netaccess DOT co DOT nz> NNTP-Posting-Host: cu-dialup-0008.cit.cornell.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Richard Chappell wrote: why on earth did you post a rhide bug report? the fact that you don't know C is not a bug in rhide for god's sake. basic C questions are off-topic for this ng. you'd be better off asking them in news:comp.lang.c or news:comp.lang.c.moderated. and believe it or not, the comp.lang.c faq (there is a we version, search for it on yahoo) is a good thing to read. > My problem is the following: > ============================ > this is my sample program... > > #include > > typedef struct > { > int za; > } mystruct; > > int main() > { > mystruct a[2]; > mystruct b; > mystruct *p,*p2; > > a[0].za=98; > a[1].za=99; > b.za=5; > *p=b; // for this one I get a SIGSEGV error write what you mean. you mean 'i want p to point to b, right? p = &b; > p2=a[0]; // for this one I get a 'incompatible types in assignment' again, you want p2 to to point to the first element of the array, you do not want to assign a mystruct to p2. p2 = a; or p2 = &a[0]; should work. -- ---------------------------------------------------------------------- A. Sinan Unur Department of Policy Analysis and Management, College of Human Ecology, Cornell University, Ithaca, NY 14853, USA mailto:sinan DOT unur AT cornell DOT edu http://www.people.cornell.edu/pages/asu1/