Here is the question....Write a statement that declares a prototype for a function divide that takes four arguments and returns no value. The first two arguments are of type int . The last two arguments arguments are pointers to int that are set by the function to the quotient and remainder of dividing the first argument by the second argument. The function does not return a value.
Here is my code - void divide(int , int, pInt* quotient, pInt* remainder);
But it doesn't work! What am I doing wrong? Thanks in advance guys!
5 8597
Here is the question....Write a statement that declares a prototype for a function divide that takes four arguments and returns no value. The first two arguments are of type int . The last two arguments arguments are pointers to int that are set by the function to the quotient and remainder of dividing the first argument by the second argument. The function does not return a value.
Here is my code - void divide(int , int, pInt* quotient, pInt* remainder);
But it doesn't work! What am I doing wrong? Thanks in advance guys!
Off the top of my head I'd say that looks right (you might consider trying to put variable names in the int places, or taking them out of the quotient/remainder, but that also looks like a function declaration, in which case I didn't think it mattered...), can you post the entire code you are using?
Off the top of my head I'd say that looks right (you might consider trying to put variable names in the int places, or taking them out of the quotient/remainder, but that also looks like a function declaration, in which case I didn't think it mattered...), can you post the entire code you are using?
Well, its a website where I input information/codes and it tells me if it a correct. So I don't have the whole code just the question. Sorry.
Well, its a website where I input information/codes and it tells me if it a correct. So I don't have the whole code just the question. Sorry.
Ah, I got it to work. It ended up being void divide(int a, int a, int* quotient,int* remainder);
I had my doubts about pInt* - I don't think that's even a supported type. int* would have been correct.
Glad to see you got it!
And just so you are aware - void divide(int a, int a, int* quotient,int* remainder); uses the same variable name in two different places. When you try to access one of the ints, you will not be able to get the value inside the function - you will only get one, I'd recommend changing it to either a descriptive name or 'b' or something.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: James Marshall |
last post by:
I'm writing a library where I want to override document.write(), but for
all document objects; thus, I want to put it in the prototype. I tried
Document.prototype.write= my_doc_write ;
but it...
|
by: Ben |
last post by:
Hi all,
Just wondering how to write (using document.write) to a table cell. I
have table with 3 rows and 3 colums. I want to write from within the
Javascript to say third column of a first row....
|
by: Roy Hills |
last post by:
I've seen two different function prototype formats used for ANSI C,
and I'm unsure as to which is the correct or preferred one.
1st Format (this is what I use)
type function(type, type, type);...
|
by: Thierry Loiseau |
last post by:
Hello all,
and Happy end year 2005 !
Well, I would like to obtain a list of all JavaScript var statement,
With "for...in" perharps ?
That is bellow my recent test here, but the problem is...
|
by: eman1000 |
last post by:
I was recently looking at the prototype library
(http://prototype.conio.net/) and I noticed the author used the
following syntax:
Object.extend(MyObj.prototype, {
my_meth1: function(){},...
|
by: Vince Castellano |
last post by:
Hello,
I have a set of DLLs that implement different configurations of the
same API. Consider them as first.dll, second.dll, and third.dll. They
all share a common API, calling pattern, and have...
|
by: jonniethecodeprince |
last post by:
Hi all,
I was wondering if anyone could help me display the HTML in a javascript that displays a table of data of prototype cinema listings.
This code brings up a Syntax error: Object...
|
by: Break2 |
last post by:
I am trying to write a simple program which asks a user to enter 5 integers after which the average will be computed and written to the screen. That simple.
However I want to do it according to a...
|
by: June Lee |
last post by:
Is that for Class/Object function prototype, I must define the
function in header file or .cpp file.
MyClass::functionA();
MyClass::functionB();
but for C function prototype, I don't have to...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |