Nope, just pointing out that fact...Allready finished school-good exercise though
Nope, just pointing out that fact...Allready finished school-good exercise though
Last edited by ninety3gd; 06-13-2009 at 10:08 PM. Reason: typo
while (digit = '\0') wrong XXXXXXXXXXXXXXX
digit is an int. value and '\0' is a character so loop will be infinite , second u aren't comparing u are assigning values , i see that the condition should be digit==0,and in if their is ma missing statement that is printf("product is 0");
No, you are wrong. The decimal value of '\0' is 0, and "digit" could equal 0. Test it yourself and see the ASCII table. You will notice the first entry in that table is "null"; that is the byte value used as the "null terminator" ('\0') in C.
You are right about the ==.
Last edited by MK27; 06-14-2009 at 09:03 AM.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Hi, Im experiencing a slight issue, this maybe what you guys were discussing. The loop works nicely except that when two zeros are multiplied the loop breaks. Is "digit != '\0'" not the correct condition for this?
that makes a lot of sense, so I changed it from "digit" to "number2", but nothings changed?
example:
101
x101
-----
101
-----
10201
when its supposed to be:
101
x101
------
101
10100
------
10201
edit: nevermind, im so dumb. got it solved.
Last question, im having it display the product only if its not the final answer or a zero, so I have this condition:
if (product != final_product || product != 0)
{
print product
}
however, only the first part of that condition works. zeros are still displayed. Is the formatting wrong? Im not getting any errors when im compiling it
Last edited by wankel; 06-15-2009 at 04:44 PM.
Try AND.
Quzah
Hope is the first step on the road to disappointment.