Pointers on pointers.

kevin reilly reilly at bnlux1.bnl.gov
Sat Apr 6 03:38:43 AEST 1991


I declare a structure that contains other structures:
struct strType {
struct dataType1 data1;
struct dataType2 data2;
};

If dataType1 is known in advance as containing only ints can I do the
following:
declaration: void FUNC1(int *input);
usage: FUNC1(&strType.data1);

as opposed to the more correct procedure:
declaration: void FUNC1(dataType *input);
usage: FUNC1(&strType.data1);

Is there something totally wrong with the first way?
I have been using it quitre successfully but it bothers me to go against
what I see in the standard texts.

Thank you very much.
Kevin M. Reilly
reilly at bnlux1.bnl.gov




More information about the Comp.lang.c mailing list