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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402

3240


Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].

634


How can I pad a string to a known length?

603


What is meant by realloc()?

666


What are the string functions? List some string functions available in c.

594






write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

3171


What is data types?

628


What is storage class?

644


What is %lu in c?

674


What is a wrapper function in c?

573


Why c is called object oriented language?

576


What is a pointer value and address in c?

622


develop algorithms to add polynomials (i) in one variable

1729


how to execute a program using if else condition and the output should enter number and the number is odd only...

1648


What are pragmas and what are they good for?

566