convert.c 846 B

123456789101112131415161718192021
  1. /* convert.c -- automatic type conversions */
  2. #include <stdio.h>
  3. int main(void)
  4. {
  5. char ch;
  6. int i;
  7. float fl;
  8. fl = i = ch = 'C'; /* line 9 */
  9. printf("ch = %c, i = %d, fl = %2.2f\n", ch, i, fl); /* line 10 */
  10. ch = ch + 1; /* line 11 */
  11. i = fl + 2 * ch; /* line 12 */
  12. fl = 2.0 * ch + i; /* line 13 */
  13. printf("ch = %c, i = %d, fl = %2.2f\n", ch, i, fl); /* line 14 */
  14. ch = 1107; /* line 15 */
  15. printf("Now ch = %c\n", ch); /* line 16 */
  16. ch = 80.89; /* line 17 */
  17. printf("Now ch = %c\n", ch); /* line 18 */
  18. return 0;
  19. }