[Tutorial 7] 6.What output would you expect from the following program?
#include <stdio.h>
int main (void)
{
char c, d;
c = 'd';
d = c;
printf ("d = %c\n", d);
return 0;
}
int main (void)
{
char c, d;
c = 'd';
d = c;
printf ("d = %c\n", d);
return 0;
}
Output:
d = d
Explanation:
- The character variable `c` is assigned the character `'d'`.
- Then, the value of `c` is assigned to the character variable `d`.
- Finally, the program prints the value of `d`, which is `'d'`.
Comments
Post a Comment