Examveda

What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int x = 97;
    char y = x;
    printf("%c\n", y);
}

A. a

B. b

C. 97

D. Run time error

Answer: Option A

Solution (By Examveda Team)

1. Declaration: int x = 97;

2. Conversion: char y = x;

3. ASCII Value: The ASCII value of 97 corresponds to the character 'a'.

4. Print: printf("%c\n", y); prints the character 'a'.

This Question Belongs to C Program >> C Fundamentals

Join The Discussion

Comments (1)

  1. Sandhya Kadam
    Sandhya Kadam:
    1 year ago

    Value of the ASCII a is 97 so as per statement y=x and x=97 ,
    here
    x=97
    y=x
    97=a (ASCII table)

Related Questions on C Fundamentals