445 views
0 votes
0 votes

What is the output for following code and how integer value can be assigned to a character value?

#include <stdio.h>

int main()

{

    char a = 30, b = 40, c = 10;

    char d = (a * b) / c;

    printf ("%d ", d);

    return 0;

}

2 Answers

0 votes
0 votes
internally char is represented as integers, so it doesnt make a difference

Related questions

1 votes
1 votes
1 answer
1
Shashank Kumar Mishr asked May 17, 2017
711 views
predict the correct options#include <stdio.h>int main(){ if (sizeof(int) -1) printf("Yes"); else printf("No"); return 0;}1.yes2.no3.compiler error...
1 votes
1 votes
1 answer
2
Shashank Kumar Mishr asked May 17, 2017
2,607 views
Assume that the size of char is 1 byte and negatives are stored in 2's complement form#include<stdio.h>int main(){ char c = 125; c = c+10; printf("%d", c); re...
2 votes
2 votes
1 answer
3
Shashank Kumar Mishr asked May 17, 2017
1,315 views
Predict the output of following program. Assume that the numbers are stored in 2's complement form.#include<stdio.h>int main(){ unsigned int x = -1; int y = ~0; if...