473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

pointer to pointer

hi
could someone tell me a good website that explains pointer to pointers well.
Not just simple stuff like 2d arrays passing , or pointing to another int
variab.le
May 30 '06 #1
3 5347
jagguy wrote:
hi
could someone tell me a good website that explains pointer to pointers well.
Not just simple stuff like 2d arrays passing , or pointing to another int
variab.le


Not sure that there is one - how hard can it be really.
*p returns a reference to whatever p points to. If p points to a pointer,
**p returns a reference to whatever that pointer points to.

There's one for function pointers though, since they have tricky syntax (function-pointer.org ?).

What do you want to do?
Many times pointer wrangling can be replaced by something safer and easier to work with.

Sorry to be of little help

homsan
May 30 '06 #2
jagguy posted:
hi
could someone tell me a good website that explains pointer to pointers
well. Not just simple stuff like 2d arrays passing , or pointing to
another int variable

A pointer variable stores a memory address. Plain and simple.

If it's a pointer variable of any kind, it stores a memory address.

The following variable stores an integer:

int k;
The following variable stores a memory address:

int *p;
It doesn't just store ANY memory address though, it's supposed to store
the memory address of an "int".

How do we store the memory address of an "int*". Simple, with a pointer
to an "int*":
int **pp;
Here's a sample:

int main()
{
int k = 5;

int *p = &k;

int **pp = &p;

int ***ppp = &pp;

int ****pppp = &ppp;

int *****ppppp = &pppp;
*****ppppp = 7;

}
-Tomás
May 30 '06 #3
Here is slightly complicated example using **pointers:

class Boo
{
int num;
Boo* next;
} ;

void main()
{
Boo emp1, emp2, *pointer0, **pointer1;

pointer0 =&emp1; //point pointer0 to emp1

*pointer1 = &pointer0; //point pointer1 to wherever pointer1 is
pointing to

(*pointer1)->next = &emp2; //use pointer1 to set next of emp1 to point
to emp2

(*pointer1)->num = 5; //use pointer 1 to set emp1's num to 5

return ;
}


jagguy wrote:
hi
could someone tell me a good website that explains pointer to pointers well.
Not just simple stuff like 2d arrays passing , or pointing to another int
variab.le


May 31 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Carsten Spieß | last post by:
Hello all, i have a problem with a template constructor I reduced my code to the following (compiled with gcc 2.7.2) to show my problem: // a base class class Base{}; // two derived...
110
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object...
3
by: Bruno van Dooren | last post by:
Hi All, i have some (3) different weird pointer problems that have me stumped. i suspect that the compiler behavior is correct because gcc shows the same results. ...
35
by: tuko | last post by:
Hello kind people. Can someone explain please the following code? /* Create Storage Space For The Texture */ AUX_RGBImageRec *TextureImage; /* Line 1*/ /* Set The Pointer To NULL...
16
by: junky_fellow | last post by:
According to Section A6.6 Pointers and Integers (k & R) " A pointer to one type may be converted to a pointer to another type. The resulting pointer may cause addressing exceptions if the...
204
by: Alexei A. Frounze | last post by:
Hi all, I have a question regarding the gcc behavior (gcc version 3.3.4). On the following test program it emits a warning: #include <stdio.h> int aInt2 = {0,1,2,4,9,16}; int aInt3 =...
16
by: aegis | last post by:
Given the following: int a = 10; int *p; void *p1; unsigned char *p2; p = &a;
23
by: bluejack | last post by:
Ahoy... before I go off scouring particular platforms for specialized answers, I thought I would see if there is a portable C answer to this question: I want a function pointer that, when...
69
by: fieldfallow | last post by:
Hello all, Before stating my question, I should mention that I'm fairly new to C. Now, I attempted a small demo that prints out the values of C's numeric types, both uninitialised and after...
8
by: Martin Jřrgensen | last post by:
Hi, "C primer plus" p.382: Suppose we have this declaration: int (*pa); int ar1; int ar2; int **p2;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.