|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: Beginner question
Speed is a major advantage to pointers, but if you're passing structures to a function (at least in C) they get passed by value. This means that a copy of the original structure is sent to the function, so whatever you do in within the function to the structure has no effect on the main structure itself. In order to change a value in the original structure you'll need to pass the pointer. (The only exception to this rule are arrays.) This is my understanding of how it works in C. I hope this helps. Phil --- wegifford <wegifford@GRUMPY.FORTLEWIS.EDU> wrote: > Hey there, > I am a beginner and I am covering pointers and > have a few questions. The > book I am using is not giving me the best > explanation. The code makes tons of > sense but I want to know a little more about what a > pointer is. > As I understand it a pointer variable is pointing > to a variable location in > memory. So when passed in a function it is not > exactly being passed but where > the variable is located is being pass. What is a > pointer exactly used for? Is > the previous explantion the answer. If so when is > the best time to declare > and use pointers? What is a benefit of a pointer? Is > it just speed? Any help > you all could give would shed light on this concept. > > > William > > > ================================================================= > The GameProgrammer.Com mailing list is for the open > discussion > of any topic related to the art, science, and > business of > programming games. This list is especially tolerant > of beginners. > We were all beginners once > > To SUBSCRIBE or UNSUBSCRIBE please visit: > http://gameprogrammer.com/mailinglist.html __________________________________________________ Do You Yahoo!? Yahoo! Photos -- now, 100 FREE prints! http://photos.yahoo.com ================================================================= The GameProgrammer.Com mailing list is for the open discussion of any topic related to the art, science, and business of programming games. This list is especially tolerant of beginners. We were all beginners once To SUBSCRIBE or UNSUBSCRIBE please visit: http://gameprogrammer.com/mailinglist.html
|
|