Member Avatar for userlain

The structure:

typedef struct{ int val[256]; }values;

The function(needs to pass information into the structure array 'val'):

void changeval(values *obj, int v, int a){ (*obj).val[v]=a; }

^^That piece is the piece I am having issues with...


And finally, the call:

int main(){ values item; changeval(&item,0,50); return 0; }

Ok, why can't I pass a user-defined datatype into a function and be able to access the array that is in the object? :sad:

Member Avatar for CrazyDieter

For me there is no problem with this code actually.

Can you tell more about the problem you have ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.