DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Thread: Pointers

  1. #1
    Philip Guest

    Pointers


    I have worked through a "old" pc-tutorial for programming in c.I'm good at
    programming in VB and want to know C/C++ as well as I know VB. I've got one
    hickup though.To me this tutorial did not explain pointers to me.E.g. I still
    get confused where to on how to use them correctly. Is there an easier way
    to learn these priciples? And when do I use the adress of an array/variable
    "&variable" instead of it self?

  2. #2
    jonnin Guest

    Re: Pointers


    Memory is an array of bytes on most machiines. A pointer is a large integer
    variable that contains a number. That number is the index into the array
    of memory where your real data is. It can be any data type, or an array,
    or a struct/class.

    & variable gets the index in memory of a variable. Usually used to get a
    pointer to that variable or to send a normal variable to a procedure that
    wants a pointer.

    * jumps to the location in the pointer to get the data.

    -> is for structures and classes to get data out of member pointers.

    if you have a pointer to an array, you can use [] to jump in as C stores
    them the same way as arrays. A way to think of this is an array name is a
    pointer, and a pointer to an array is therefore the same thing.




    "Philip" <pcoetzee@cps.altron.co.za> wrote:
    >
    >I have worked through a "old" pc-tutorial for programming in c.I'm good

    at
    >programming in VB and want to know C/C++ as well as I know VB. I've got

    one
    >hickup though.To me this tutorial did not explain pointers to me.E.g. I

    still
    >get confused where to on how to use them correctly. Is there an easier way
    >to learn these priciples? And when do I use the adress of an array/variable
    >"&variable" instead of it self?



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links