Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pointer question - might be silly

Status
Not open for further replies.

billbose

Programmer
Jan 15, 2001
66
US
Code:
char *hname ;
char **tname ;

I know hname is a pointer to a char.
But what is tname?! :(
 
Think of pointers as variables that contain memory addresses. tname contains a memory address of a variable that contains the address of a character. Pointer to a pointer variables are often synonymous with arrays, and char ** many times indicates a pointer to an array of character strings (which are null terminated char arrays).

Dereferencing a pointer variable means you access the contents at the memory address in the pointer variable.

Clear as mud now? :)# Pointers are usually considered the most difficult thing to learn in C/C++.

I know I didn't really get a handle on them until I had a dream one night about programming using them. I woke up from the dream while it was still dark out and wrote down what I'd dreamed of programming by the light of the moon. In the morning I tried the code and it compiled and worked perfectly, and since then have had little trouble with them. :)# I'm not sure how others have gotten the concept down, though.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top