473,383 Members | 1,978 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,383 software developers and data experts.

Write a statement that declares a prototype for a function divide

64
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

Expand|Select|Wrap|Line Numbers
  1. void divide(int , int, pInt* quotient, pInt* remainder);
But it doesn't work! What am I doing wrong? Thanks in advance guys!
Feb 14 '07 #1
5 8597
sicarie
4,677 Expert Mod 4TB
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

Expand|Select|Wrap|Line Numbers
  1. 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?
Feb 14 '07 #2
td0g03
64
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.
Feb 14 '07 #3
td0g03
64
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);
Feb 14 '07 #4
Ganon11
3,652 Expert 2GB
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!
Feb 14 '07 #5
sicarie
4,677 Expert Mod 4TB
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.
Feb 14 '07 #6

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

Similar topics

9
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...
8
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....
13
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);...
35
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...
13
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(){},...
4
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...
2
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...
4
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...
3
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...
0
isladogs
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...
0
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...
0
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,...
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: 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$) { } ...
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: 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
0
BarryA
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...
1
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...

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.