"array" vs. "&array" ?

Conor P. Cahill cpcahil at virtech.uucp
Sun Dec 24 02:14:11 AEST 1989


In article <571 at mwtech.UUCP>, martin at mwtech.UUCP (Martin Weitzel) writes:
> To my understanding, the following *is* a type mismatch:
> -----------------------------------------------------------------------
> main()
> {
> 	char a[10], (*p)[10];
> 
> 	p = a;
> warning: illegal pointer combination, op =
> }

Did you try a cast?  Try the following:

main()
{
 	char a[10], (*p)[10];
 
 	p = (char (*)[10]) a;
}

this worked fine for me.  No complaints from the compiler.

-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+



More information about the Comp.lang.c mailing list