Article View: comp.std.c
Article #5028Q: char **foo, char *foo[], and char foo[][] ?
From: Philippe Maurisset
Date: Wed, 17 Apr 1996 15:46
Date: Wed, 17 Apr 1996 15:46
41 lines
1495 bytes
1495 bytes
Considering the 3 following declarations:
1 - char **foo;
2 - char *foo[];
3 - char foo[][];
I know that there is a (big !) difference in memory reservation, but I do not know
if foo IS or IS NOT of the same type in these three cases.
To summarize my question :
Is the first one securely usable for casting a variable of the third kind, when
calling a function where it is defined as the second kind ?
Follwing is a description (the 2 functions are in differents sources files) :
myexample()
{
char foo[MAX_X][MAX_Y];
...
myfunc( (char **)foo );
}
void myfunc( char *foo[MAX_X] )
{
...
}
Can anybody help me ? Is it system-dependent ?
Many thanks in advance,
Philippe.
--
+-----------------------------+-----------------------------+
| Philippe MAURISSET | |
| Lectra Systemes | Phil@RD.Lectra.fr |
| Chemin de Marticot, BP 34 | tel : +33 57.97.80.00 |
| 33611 CESTAS Cedex | direct: +33 57.97.81.13 |
| FRANCE | fax : +33 57.97.82.32 |
+-----------------------------+-----------------------------+
Technical Details
Message-ID:
<4l33ok$oo2@Sherlock.lectra.fr>Path:
arc1-ca.pugleaf.net!lectra.fr!noe!philShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!lectra.fr!noe!phil From: phil@rd.lectra.fr (Philippe Maurisset) Newsgroups: comp.std.c Subject: Q: char **foo, char *foo[], and char foo[][] ? Date: 17 Apr 1996 15:46:28 GMT Organization: Lectra Systemes, Cestas, France Distribution: world Message-ID: <4l33ok$oo2@Sherlock.lectra.fr> NNTP-Posting-Host: noe.lectra.fr