Nope, just pointing out that fact...Allready finished school-good exercise though
Printable View
Nope, just pointing out that fact...Allready finished school-good exercise though
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 ==.
'\0' is an int. Character literals in C are ints.
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
Try AND.
Quzah