
Newbie Array Problem BC/C++ v4.0
Quote:
>Here goes:
>main()
>{
> void foo(char *);
> char MyArray[2][50];
> char *ptrMyArray;
> ptrMyArray = MyArray; generates "suspicious pointer conversion"
It is. 'MyArray' is char[][], which can decay into 'char **' in expressions.
'ptrMyArray' is char[], which can decay into 'char *' in expressions.
Quote:
>I give up. Also, I had to modify the orginal code so that foo
>accepted a pointer variable instead of a pointer constant.
>I would prefer to pass foo MyArray (a pointer constant) instead of
>ptrMyArray (a pointer variable).
'MyArray' as declared is an array of objects of type array of char, i.e.,
it's a (nearly, though technically not) multi-dimensional array. This
is not legitimately equivalent to a 'char *'. Try 'ptrMyArray = MyArray[0];'
and see if that helps.
Quote:
>email:
-seebs
--
GAT(CS/M/P/SS) d-- H++ s+: !g p? !au a- w+++ v+++/* C++++ UB/V++++ P+ L b+++ !D
3+(NetBSD/Amiga) E- N+++ K !W--- M++/-- V- -po+ Y+ t 5++ jx R G'''' tv- B---
e++ u** h--- f+ r+++ !n x+++* --SeebS-- / The Laughing Prophet