char ch=10;printf("%d",ch);what is the output

Answers were Sorted based on User's Feedback



char ch=10;printf("%d",ch);what is the output..

Answer / abdur rab

The output will be 10.

char consists of 1 byte = 8 bits

it can hold any value between 0 - 127
an unsigned char can hold any 0 - 256

the asci value 10 is newline,
so if u format it as char using %c
printf ( "\n|%c|", ch ); the 10 is converted to new line

otherwise if u format it to int using %d, it ud print 10

Is This Answer Correct ?    18 Yes 1 No

char ch=10;printf("%d",ch);what is the output..

Answer / suganya

10

Is This Answer Correct ?    21 Yes 13 No

char ch=10;printf("%d",ch);what is the output..

Answer / rani

output is

10

Is This Answer Correct ?    10 Yes 5 No

char ch=10;printf("%d",ch);what is the output..

Answer / vaibhav

it prints the ascii value of 10. inthese case ineger 10
will occupy only 1 byte.

Is This Answer Correct ?    3 Yes 0 No

char ch=10;printf("%d",ch);what is the output..

Answer / rogerthatrambo

although i know the answer:
what should be output of this:
do it without running.

int main()
{
char ch='48';
printf("%d %c",ch,ch);
}

Is This Answer Correct ?    1 Yes 0 No

char ch=10;printf("%d",ch);what is the output..

Answer / yash

my output is for
What is output of followingvoid main() [3]
{char ch;for(ch=0;ch<=127;ch)printf("%c %d \n", ch, ch);}

ans: 1024

Is This Answer Correct ?    0 Yes 0 No

char ch=10;printf("%d",ch);what is the output..

Answer / shruti

@Devvvv
every character has an ascii value..
it is not that only 0 - 9 has ascii values.. even 10 , 20
has ascii values.

each and every value has an ascii value..

comming back to the ques:
i think it will give the ascii value of 10...

Is This Answer Correct ?    3 Yes 4 No

char ch=10;printf("%d",ch);what is the output..

Answer / rahul shrivastava

surely ans will be 10.
bcz we are using %d access specifire..if we will use %c then
correnponding symbol of asciii valut 10 will be display(but
is becoms invisible)

Is This Answer Correct ?    0 Yes 1 No

char ch=10;printf("%d",ch);what is the output..

Answer / devvv

this program is gonna give output 10.coz ascii values are
assigned to only 0....9.when we execute printf("%
c",ch);.........the output screen will be blank.

Is This Answer Correct ?    1 Yes 4 No

char ch=10;printf("%d",ch);what is the output..

Answer / marc

58
Ascii of '0' is 48
thus, ascii of '10' is 48+10=58

Is This Answer Correct ?    6 Yes 14 No

Post New Answer

More C Interview Questions

What is Function Pointer? Explain with example?

3 Answers  


What is difference between array and structure in c?

0 Answers  


Program to find the sum of digits of a given number until the sum becomes a single digit

8 Answers   InterGraph,


what are the advantages of a macro over a function?

0 Answers   TCS,


how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

0 Answers   Gopaljee, TCS,






program for following output using for loop? 1 2 3 4 5 2 3 4 5 3 4 5 4 5 5

8 Answers   Infosys,


The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none

0 Answers  


who developed c and why he developed c?

5 Answers  


Explain what is the heap?

0 Answers  


Write a program which has the following seven functions. The functions should be: • main() this calls the other 6 functions • fget_long() a function which returns a long data type from a file • fget_short() a function which returns a short integer variable from a file • fget_float() a function which returns a floating point variable from a file • fprt_long() a function which prints its single, long argument into a file • fprt_short() a function which prints its single, short argument into a file • fprt_float() a function which prints its single, floating point argument into a file. You should use fscanf() to get the values of the variables from the input (the file) and fprintf() to print the values to the other file. Pay attention to using the correct format for each of the data types.

0 Answers  


What is C++

4 Answers  


Write a program in C to convert date displayed in gregorian to julian date

0 Answers   HCL, Wipro,


Categories