From: "Maan M. Hamze" Newsgroups: comp.os.msdos.djgpp Subject: Re: Pointers, arrays and assignments Date: 15 Dec 1996 08:19:30 GMT Organization: University of Texas at Austin Lines: 25 Message-ID: <01bbea60$9331e020$23705380@maan-m.-hamze> References: <32B3AA6F DOT 1302 AT synapse DOT net> NNTP-Posting-Host: slip-36-3.ots.utexas.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Bill Lachance wrote in article <32B3AA6F DOT 1302 AT synapse DOT net>... >But when I try a stunt like: > plyr[0]->X=4960, the program crashes abruptly (I've isolated the > problem). > > Am I breaking some unknown rule here? > Hi Bill I am no professional on pointers but I know this much: You are not setting your pointer to an address before dereferencing it. Let me quote from Stephen Prata's book "C++ Primer Plus" (pub by Waite Group): Pointer Golden Rule: ALWAYS set a pointer to a definite and appropriate address before applying the dereferencing operator (*) to it.(page 127). You may want to check Chapter Four "Derived Types" in Prata's book on pointers and his golden rules. Or check Chapter 8 on Pointers in the new book from Waite Group by Robert Lafore: C++ Interactive Course. Maan -- Maan M. Hamze mmhamze AT mail DOT utexas DOT edu http://leb.net/~mmhamze