|
From: Ioannis V. <iv...@em...> - 2003-07-10 21:45:59
|
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of dawood
Sent: Thursday, July 10, 2003 11:36 PM
To: Dev C++
Subject: [Dev-C++] three queries
1.does anybody know how to create a typedef for an array of 8 arrays of =
7
pointers to int.
2. char c[]=3D"hello";
char* pc=3D c;
char** ppc =3D &pc;
does anybody know a much shorter method to create a pointer to
pointer to char. I am doing it in 3 statements. Can anybody show me how =
to
do it in less than 3 statements. =20
=20
=20
At first you should mention language, i assume C.
=20
A typedef? I do not see any typedef above. Perhaps today i have had much
critical mood but do you know what you are doing above?
=20
You create a char array in the automatic storage and then you point to =
the
first element of it using a char pointer and you point to that char =
pointer
using a pointer to char pointer.
=20
=20
If you want to access the first element of the array using the char ** =
you
can do directly:
=20
char c[]=3D"hello";
=20
char **ppc=3Dc;
=20
=20
3. Also can anybody show me how to create a non constant reference to
pointer to pointer to char.=20
=20
Well, you are talking about C++. You can't do that. You can use =
references
to pointers only to templates.
=20
=20
Example:
=20
template <class T>
inline T &rfer(T &r) { return r; }
=20
=20
But the above is useless.
=20
=20
=20
=20
=20
Ioannis Vranos
* Programming pages: <http://www.noicys.freeurl.com/>
http://www.noicys.freeurl.com
* Alternative URL 1: <http://run.to/noicys> http://run.to/noicys
* Alternative URL 2: <http://www.noicys.cjb.net/> =
http://www.noicys.cjb.net
|