From: Rod B. <ro...@bo...> - 2007-04-18 23:03:27
|
I take it you have never heard of: ( ArrayOfStruct + 1 )->Element It is just a style thing but I have never like the idea of passing a pointer to an array without passing the number of elements in that array. I also don't like referencing the second element in the array in a function like this either but I'm sure(hope) this is a simple example. If as in the original question you are wanting to reference the elements in the structure pointer then you should just use the arrow operator or pointer dereferencing this is simple C code that any book will be able to help you with. Regards, Rod Boyce Dominik Cabrerizo wrote: > Hi Dia! > > I did the same thing today. Took me some time to figure it out... > My code is like this: > > void func(struct myStruct* ArrayOfStruct) { > x = ArrayOfStruct[1].Element //just es example to access Element in ArrayOfStruct[1] > } > > Maybe this helps you. Could you send some code? > > Regards > Dominik > > -------- Original-Nachricht -------- > Datum: Sat, 14 Apr 2007 02:59:55 -0400 > Von: "Dheya Ghazi Mustafa" <Dhe...@uk...> > An: sdc...@li... > Betreff: [Sdcc-user] passing pointer of struct to function > > >> Hi, >> I am tri\ying to pass a pointer of struct to function. >> I received the following error. >> >> C:/plansw_006_doc/CoordinateMapper.c:59: >> error 52: Actual Argument type different from declaration 1 from type >> 'struct piccolodatastruct generic* ' to type 'struct piccolodatastruct generic* >> ' >> >> >> any suggestions may be helpfull. >> >> Thanks >> Dia >> >> >> ------------------------------------------------------------------------- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to share >> your >> opinions on IT & business topics through brief surveys-and earn cash >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> _______________________________________________ >> Sdcc-user mailing list >> Sdc...@li... >> https://lists.sourceforge.net/lists/listinfo/sdcc-user >> > > |