Question

main.c #include <stdio.h> int main() { Tong Tong int x = 1234567890000; char y = (char) x; printf(%d\n, y); Compile and run

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a) The meaning of the lags are-

  1. -wall is used to enable all types of warnings generated which can be ignored. Hence, will not affect compilation.
  2. -werror converts all warnings to error. Since error leads to compilation failure, it can affect the compilation.
  3. -pedantic geenartes all warnings related to ISO C. Since this also issues warnings, will not affect compilation.
  4. There is no flag with this name, i.e.., overflow in Linux gcc command.

Hence, only command 2 can cause compilation failure, rest generates warnings, so no change in compilation.

b) In this program, a long long int is converted to char, which is much smaller data structure. So, there will be very high data loss. As a programmer, all such type of conversions should be avoided.

c) It will lead to an error, as very large information of long long int is tried to be stored in small size, i.e, char. So, it will cause compilation error and hence failure.

Since none of the flags in part a suppresses errors, none of them will make it compile successfully.

I hope it helps. For any doubt, feel free to ask in comments, and give upvote if u get the answer.

Add a comment
Know the answer?
Add Answer to:
main.c #include <stdio.h> int main() { Tong Tong int x = 1234567890000; char y = (char)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT