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

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.