Struct array - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Struct array

im tooim too Posts: 42Member
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'.

Comments

  • DonotaloDonotalo Posts: 715Member
    : 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'.
    :
    :
    [purple]
    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:

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

    then pass the [blue]data[/blue] array as follows:

    [b][black]check (data);[/b][/black]
    [/purple]
    [hr][purple]~Donotalo()[/purple]

Sign In or Register to comment.