By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,171 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,171 IT Pros & Developers. It's quick & easy.

Passing structure to function, help!!

P: 17
I have a database called OpAmps with 3 members, name, pincount and slewrate

I have a menu system where the save function arguments are stated as

Save(OpAmp, database_length)

OpAmps OpAmp[DATABASE_MAX]

is defined above and database max is ten, database length is 0 to begin with

When creating the function prototype i have written

void Save(OpAmps, unsigned long)//opamp is not defined until later in the code

but when writing the function i get an error saying that it cannot convert paramter one of Save from OpAmps[10] to OpAmps

I am not sure how to correct this error, any ideas?
Mar 12 '07 #1
Share this Question
Share on Google+
1 Reply


DeMan
100+
P: 1,806
Please do not double post.....
If your post dissappears too far down the queue and you think it won't be found, adding a question to that same post will resurrect it to the top again.....

basically you are declaring
Expand|Select|Wrap|Line Numbers
  1. Save(opAmps, database_length)
  2.  
when you pass OpAmp, however, you are passing an Array of OpAmps (which as far as teh compiler is concerned is a different Structure).....

Instead pass an array to save

Expand|Select|Wrap|Line Numbers
  1. Save OPAmps[], database_length);
  2.  
Mar 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.