C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28629
Number of posts: 94611

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Struct array Posted by im too on 23 Apr 2006 at 9:26 AM
hi,
can i paas 'struct array' through any function.....let suppose as

stuct entry{int id,age;}data[10]; and function is like this
void check(int d[10]);
if it is possible..then......how can?....please teach by syntax
in term of 'c'.

Report
Re: Struct array Posted by Donotalo on 23 Apr 2006 at 10:02 PM
: hi,
: can i paas 'struct array' through any function.....let suppose as
:
: struct entry{int id,age;}data[10]; and function is like this
: void check(int d[10]);
: if it is possible..then......how can?....please teach by syntax
: in term of 'c'.
:
:

of course u can pass a struct array through a function parameter. but as other arrays, that must be passed as reference.
the code u provided cannot take a struct array as its parameter since the parameter is declared to take an interger array of size 10. u need to modify the function declaration in order to accept the struct array as follows:

void check (struct entry array[10]);[/black]

then pass the data array as follows:

check (data);[/black]


~Donotalo()




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.