When you pass &i to scanf, you're saying "put it at the MEMORY ADDRESS of i". That's what & does; it gets the memory address of the specified variable. If you tried to pass "i", you'd tell scanf to overwrite memory address 0 with the number.
Printf, on the other hand, expects the value, not the memory address. Remove the &.
Thanks.
It works now.
Now the mods can lock the thread! :biggrin.gif:
I'm making a program that asks for a number, and then tells you what number you entered.
But when I enter a number, it just says 2293620 which is not the number I entered.
Here is the source code:
#include <stdio.h>
int main(void)
{
int i = 0;
printf("Please enter a number.\n");
scanf("%d", &i);
printf("You entered %d", &i);
return 0;
}
Fun test to see if you know the first thing about implementing calculators:
Evaluate the following:
6 9 2 - 6 * 3 * + 7/ = ??
That does not make mathematical sense.
There are two missing integers.
So I will replace the integers with 0s.
692 - 18 = 674.
674 * 0 = 0.
0 + 7 = 7.
7 / 0 = ERROR MALFUNCTION ERROR ERROR (undefined)
So the answer would be undefined.
EDIT: Silly madk, you switched the digits in 692! :tongue.gif:
Fun test to see if you know the first thing about implementing calculators:
Evaluate the following:
6 9 2 - 6 * 3 * + 7/ = ??
That does not make mathematical sense.
There are two missing integers.
So I will replace the integers with 0s.
692 - 18 = 674.
674 * 0 = 0.
0 + 7 = 7.
7 / 0 = ERROR MALFUNCTION ERROR ERROR (undefined)
So the answer would be undefined.
EDIT: Silly madk, you switched the digits in 692!
There are 3 variations - 8 bit, 16 bit, and 32 bit. Read the readme for the differences, read reference.txt for the complete command set. Post any questions here if it's hard to understand and I'll do my best to clarify. Please note that it's not verified to be 100% bug free.
0
It works and I tested it.
But it's not that good. :\
0
Thanks.
It works now.
Now the mods can lock the thread! :biggrin.gif:
0
But when I enter a number, it just says 2293620 which is not the number I entered.
Here is the source code:
What is wrong with the code? ;_;
0
Is this a new form of math?
0
So you are saying 6 7 8 - 3 = 3 4 5?
Excellent logic.[/sarcasm]
0
Why are you adding the spaces?
And what does * + mean?
And it is not possible for a human to carry out this floating point.
0
I am capable of making a text (console) calculator.
But I can't do a GUI calculator.
0
That does not make mathematical sense.
There are two missing integers.
So I will replace the integers with 0s.
692 - 18 = 674.
674 * 0 = 0.
0 + 7 = 7.
7 / 0 = ERROR MALFUNCTION ERROR ERROR (undefined)
So the answer would be undefined.
EDIT: Silly madk, you switched the digits in 692!
0
0
I know.
It's the lowest high-level language out there.
I think Gigyas has invaded the digital world now. 0_o
0
I don't understand this language at ALL.
It's even more complicated than C...
0
Don't forget the steering wheel.
And fuel.
And *gets hit by lawnmower*
0
What does the M stand for?
0
I meant a text calculator.
I can make one of those.
0
By run manually, I mean if I could run the compiler directly on Command Prompt.