I declared one variable in one type (say char x ) and allocated. But i'm assigning integer or some other type value to it. Below is the code snippet which i'm facing problem,
char *tempstr = (char*)calloc(1,4); // declaring with char variable tempstr = '2'; // trying to assign 5 as integer value //tempstr = '(' // trying to assign '(' character tempstr = '50' //trying to assign '1' boolean value tempstr = 47 //trying to assign 47 integer value
but when i debugged and found in memory address that values stored for '2', '50', '47' are 30, 32 , 2f respectively. When i map these value to respective ASCII code only '2' get correct ascii code value.
Please suggest me a way to assign values in proper way.
Edited 4 Years Ago by Perry31