if we take a number as a char then can we manipulate(add,
subtract) on this number

Answers were Sorted based on User's Feedback



if we take a number as a char then can we manipulate(add, subtract) on this number..

Answer / aravind

yes.For example
#include<stdio.h>
int main()
{
int x,y;
x='A'+1;
y='B'-1;
printf("%d,%d\n",x,y);
}
It will add the Asci value of A and subtracts B, Than 62 or B will be ans for x and A or 61 will be ans for y.

Is This Answer Correct ?    8 Yes 0 No

if we take a number as a char then can we manipulate(add, subtract) on this number..

Answer / deepak garg

#include<stdio.h>
int main()
{
int x,y;
x=1+'a';
y='b'-1;
printf("%d,%d\n",x,y);
}

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C Interview Questions

write a c program to add two integer numbers without using arithmetic operator +

13 Answers   Value Labs,


which operator is known as dummy operator in c?

2 Answers   Wipro,


What does extern mean in a function declaration?

4 Answers  


what is the format specifier for printing a pointer value?

0 Answers  


What is the value of h?

0 Answers  






What is indirection?

0 Answers  


Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

0 Answers   Amazon,


What is a stream in c programming?

0 Answers  


IS Doon college of Engn.. has good faculty

1 Answers  


Without Computer networks, Computers will be half the use. Comment.

0 Answers  


Write a program to implement queue.

0 Answers   Aricent,


Distinguish between actual and formal arguments.

0 Answers  


Categories