From: Ned Ulbricht Newsgroups: comp.os.msdos.djgpp Subject: Re: Pointer problems!! Date: Mon, 26 Jan 1998 02:37:52 -0800 Organization: University of Washington Lines: 46 Message-ID: <34CC6780.3457@ee.washington.edu> References: <199801260544 DOT SAA12728 AT cirrostratus DOT netaccess DOT co DOT nz> NNTP-Posting-Host: cs250-2.student.washington.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: > 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 p is an uninitialized automatic veriable so it can contain any value, therefore *p could be anywhere in memory > p2=a[0]; // for this one I get a 'incompatible types in assignment' > // error p2 is a pointer a[0] is a mystruct > > printf("%d %d",p->za,p2->za); > > return(0); > } As Nate keeps pointing out in posts to other people, basic c/c++ questions belong in one of the c or c++ ng's. (Of course, Nate's been posting to this ng a lot longer than I have, so he can get away with saying that :). -- Ned Ulbricht mailto:nedu AT ee DOT washington DOT edu