Help me cast this!
Bill Daniels
wrd3156 at fedeva.UUCP
Tue May 3 08:09:28 AEST 1988
How do I cast the malloc() in line 12 of the following program to avoid
the lint cries of "warning: illegal pointer combination" et al?
My system is a Perkin-Elmer 3210 running SYS V rel. 2. I have tried
"all but one" of every combination of casts known to mankind. Help me find
the only one left, the one that works!
#include <stdio.h>
main()
{
char *malloc();
int i;
struct outfile {
int j;
int k;
} (*output)[];
output = malloc(sizeof(struct outfile) * 3);
(*output)[0].j = 1;
(*output)[0].k = 2;
i = printf("%d %d\n",(*output)[0].j,(*output)[0].k);
return(i);
}
THIS IS MY LINT'S OUTPUT:
trial.c
==============
warning: illegal pointer combination
(12)
warning: possible pointer alignment problem
(12)
Thanks for any assistance!
--
bill daniels
federal express, memphis, tn
{hplabs!csun,gatech!emcard}!fedeva!wrd3156
More information about the Comp.lang.c
mailing list