472,333 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 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 8473
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 ...
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...
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...
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...
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: ...
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...
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. ...
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...
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();...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...

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.