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...
3 1590
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.
void count(frequency , int&, int&);
void print(frequency );
Those are the prototypes. Frequency is a struct in a header file.
So then you call the function this way: -
count(AofS, count, total);
-
//or
-
count(&AofS[0], count, total);
-
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?
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 capabilities, unfortunately. I'd like to know if it may
be possible to add a powerful macro system to Python, while
keeping its amazing syntax, and if it could be possible to
add Pythonistic syntax to Lisp or Scheme, while keeping all
of the...
|
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. Yahoo store was originally written in Lisp.
c. Emacs
The issues with these will probably come up, so I might as well
mention them myself (which will also make this a more balanced
|
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
decorated function. You can't do that with
|
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")
----^
|
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 for some of the main form records. The
sub form simply does not accept any keys. Also the drop downs drop but when
I click to select nothing happens and drop down list just remains dropped.
What could be the reason for this? Driving me crazy.
| |
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 frustrating time with http connections in
..Net at the moment.
Basically I am working on a project in which many subsystems use http to
communicate with eachother. Once in a while, my .Net client will fail with a
"System.Net.WebException: The underlying...
|
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 doesn't work. I have errors like
parsing the querystring differently etc.Even on firefox there are mismatches
in logic. I have been trying for long to fix it, but unsuccessfully. Its
very frustrating because i can see it work on my machine.
Thanks
|
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) (void *data);
|
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;
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |