Void test(char *s)
{
int i, d;
sscanf(s, "%i", &i);
printf("%s converts to %i using %%i\n", s, i);
sscanf(s, "%d", &d);
printf("%s converts to %d using %%d\n", s, d);
}
int main()
{
test("123");
test("0x123");
return 0;
}
outputs:
123 converts to 123 using %i
123 converts to 123 using %d
0x123 converts to 291 using %i
0x123 converts to 0 using %d
As you can see, %i is capable of parsing hexadecimal, whereas %d is not. For printf they're the same.
Answer:
Education
Explanation:
Most apps for <u>learning</u> a new language are for educational purposes and are most likely an education type of app.
Try icthio.com I use that and its free.Good luck,!
Answer:
0.
Explanation:
Given
int x;
x=3/(int)(4.5+6.4)
Required
What is x?
The first line of the code segment declares x as integer. This means that, it will only hold non decimal numbers.
With the above explanation, options (a), (c) and (d) can not be true.
Solving further:
x=3/(int)(4.5+6.4)
The computer evaluates the denominator as:
x=3/(int)(10.9)
The denominator is then converted to an integer. So, we have:
x = 3/10;
3/10 = 0.3 but
Recall that: <em>x will only hold non decimal numbers.</em>
So:
x = 0;