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

what is the full form of c language

9 Answers   Satyam, TCS, VNC,


Describe the modifier in c?

0 Answers  


why do some people write if(0 == x) instead of if(x == 0)?

0 Answers  


What is variable initialization and why is it important?

0 Answers  


Explain what are the different file extensions involved when programming in c?

0 Answers  






What is double pointer?

0 Answers  


read the folllowing code # define MAX 100 # define MIN 100 .... .... if(x>MAX) x=1; else if(x<MIN) x=-1; x=50; if the initial value of x=200,what is the vlaue after executing this code? a.200 b.1 c.-1 d.50

4 Answers   TCS,


write a addition of two no. program with out using printf,scanf,puts .

4 Answers  


f1() { f(3);} f(int t) { switch(t); { case 2: c=3; case 3: c=4; case 4: c=5; case 5: c=6; default: c=0;} value of c?

5 Answers   Geometric Software,


What does s c mean on snapchat?

0 Answers  


read an array and search an element

1 Answers  


What are the ways to a null pointer can use in c programming language?

0 Answers  


Categories