Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!gatech!ncar!ico!attc!bridon From: bridon@attc.UUCP (Brian Donahue) Newsgroups: comp.lang.c Subject: Re: portability of simple struct vs. array? Message-ID: <1060@attc.UUCP> Date: 15 Feb 91 18:17:45 GMT References: <1058@attc.UUCP> Reply-To: bridon@auto-trol.UUCP (Brian Donahue) Distribution: usa Organization: Auto-trol Technology, Denver Lines: 44 In article <1058@attc.UUCP> i wrote: >Stupid question. (maybe should go into FAQ?) >i have a function that's declared as: > >foo( arg ) >double arg[3]; >{ >... >and, outside of this function i have a struct like: >typedef struct { > double xyz[3]; > } point; >Q1: can i call foo() with a pointer to a point struct? Yeah. a follow-up to my own question (good, huh?) I over-simplified the original question and people replied why dont you just call foo with p.xyz ?? Yeah, i hear ya. Actually, the situation is more like: foo is declared as: foo( arg ) double arg[6][3]; { ... and i have an array of structs of: typedef struct { double xyz[3]; double tangent[3]; } point_tan; Rephrasing my questions: Q1: can i call foo() with a pointer to a point_tan struct? eg. foo( &pttan[i] ) Q2: can i do so portably? or am i making too much of an assumption by assuming contiguous, non-padded structures? Q3: Is there some documentation in K&R that supports your answer? Because of the stupidity of this question, plz reply via email to: bridon@auto-trol.COM thanks again!