Re: Newbie pointer question



"seegoon" <seegoon99@xxxxxxxxx> wrote in message
news:1153808204.312536.317260@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi all.
I was wondering what the advantage of using pointers are( Programming
in 'C' ).For instance : I have a simple embedded controller
application
, turning a few io on and off , maybe some serial comms etc.
I can create variables (Global or local) and then access them directly
, or can access them via pointers , but is there any advantages. Does
the compiler generate more efficient code?
In simple applications "is" there any advantage to using pointers?
Can any one "Point" me in the right direction , haa haa.

In addition to Mark's excellent answer I can add the following
real-world example in which a button on my GUI may display one of a
number of different images on it depending on which language is
selected.

The image data is stored in a large array which is part of a Bitmap
structure. Rather than have to decide which language is in use and then
which picture to draw every time the button is drawn, I have a pointer
which points to whichever Bitmap structure is current. I then draw the
button image pointed to which removes the need for a decision on every
redraw. The only time the pointer is modified is when the language is
changed.


.



Relevant Pages

  • Re: Operator overloading in C
    ... All development of C as an independent language has ... making any changes or improvements to the standard ... The lack of a counted string data structure, ... Pointers can't be used for arg1 or arg2. ...
    (comp.std.c)
  • Re: pointers?
    ... There's absolutely nothing abstract in pointers. ... Take the C array: if you write ... To the assembly language programmers who were the first generation adopters of C, this mental mapping was very tight. ... Forth gained the most traction on machines like the IBM 1130 and the Data General Nova. ...
    (comp.lang.forth)
  • Re: work, life
    ... because c allows pointers (including the stack ... language BASIC. ... Phil Hobbs ... Wrote my own full-screen text editor, ...
    (sci.electronics.design)
  • Re: A good subset of C
    ... of C - i.e. of the whole programming approach including language, preprocessor, ... switch, curly braces, most of C's math and assignment operators, pointers, ... Of course, parenthesis just clutter up the code, so, fix that. ... You could consider eliminating character escape sequences, e.g., ...
    (comp.lang.misc)
  • Re: Modifying Class Object
    ... Python as a language is implemented in many languages. ... therefore has no pointers or references, ... On top of the multiple fallacies, dubious snipping of arguments, ...
    (comp.lang.python)