473,394 Members | 1,971 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Frustrating syntax problem

9
At this point in life, I thought syntax wouldn't be a problem, but it is. I'm trying to write yet another school program, but keep getting compile errors in the main function when I try to pass an array of structs to any other function. The error is operand expected instead of ",", and at this point I've managed to get it down to one error. What am I doing wrong? I've tried everything. Here are the two lines in their current form:

count(AofS[0], count&, total&);
print(AofS[0]);

Like I said this is the only error I'm getting and it's frustrating me. This program is late because of this one little problem...
Apr 18 '08 #1
3 1452
weaknessforcats
9,208 Expert Mod 8TB
You didn't post the function prototypes of these functions you are calling so this may be an incomplete answer.

1) a count& is a reference. Did you mean to pass the address of count? Like maybe it should be &count??

2) if these functions are passed an array of structs, you can just use the array name. In C++, the array name is the address of element 0. So you could pass the address of element 0 as &AofS[0] instead of using the array name.

It all comes down to the function prototype (which you didn't post) because it is there the type of the arguments is defined.
Apr 18 '08 #2
Sejoro
9
void count(frequency, int&, int&);
void print(frequency);

Those are the prototypes. Frequency is a struct in a header file.
Apr 18 '08 #3
weaknessforcats
9,208 Expert Mod 8TB
So then you call the function this way:
Expand|Select|Wrap|Line Numbers
  1. count(AofS, count, total);
  2. //or
  3. count(&AofS[0], count, total);
  4.  
Your print function only has one argument for the array. How does it know how many elements are in the array? Or does it just print one element?
Apr 18 '08 #4

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

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
23
by: C. Barnes | last post by:
I vote for def f(): (body of function) This is backwards compatible (Python <= 2.3 raise SyntaxError), and looks much nicer than @. The only problem is that you can't one-line a...
2
by: sjanie | last post by:
The error code is: Microsoft JScript compilation error '800a03ec' Expected ';' /bicc.nl/Connections/BICCwebsite.asp, line 2 Set Conn = Server.CreateObject("ADODB.Connection") ----^
1
by: John | last post by:
Hi I have a very frustrating problem. I had a perfectly working app with a sub form on a main form. I added a few fields in tables here and there and now I can not enter data on in the sub form...
0
by: Rob Levine | last post by:
(This post also available at http://roblevine.blogspot.com/2004/11/frustrating-http-connection-behaviour.html in a slightly more readable format!) Hi All, I seem to be having a bit of a...
3
by: Loui Mercieca | last post by:
Hi, I have a very strange and frustrating error. I developed an application, tested it and it works fine. Then i deploy it to another machine ( no installation, direct file transfer ) but it...
1
by: Bit byte | last post by:
I have the ff code: class MyClass { public: .... private: typedef unsigned int (*hash_func_t) (void *data); typedef int (*comp_func_t) (void *d1, void *d2); typedef void (*destroy_func_t)...
4
by: cyborg81 | last post by:
when i compile the following code it gives the following error on the line indicated in bold: #include<iostream> #include<iomanip> #include<cstdlib> using std::cin; using std::cout;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.