char * x="a"; how would i convert it to char y='a';
also if i have a short char * a="100" how can i convert it to short b=100
thanks
char * x="a"; how would i convert it to char y='a';
also if i have a short char * a="100" how can i convert it to short b=100
thanks
char * x = "a";
char y = *x; //or x[0]
char * a = "100";
short b = atoi(a);
Note that assigning return value of atoi
to a short might lead to overflow.
Also read why strtol is preferred over atoi for string to number conversions.
Assuming that's all you wanted to do and didn't care about error checking:
char y= *x;
short b= atoi(a);