changing datatypes

S

sudip chatterjee

can a signed 'int', 'long' or 'double' datatype be changed int 'char'
without using any standard library functions...

sudip
 
J

John Harrison

sudip chatterjee said:
can a signed 'int', 'long' or 'double' datatype be changed int 'char'
without using any standard library functions...

sudip

Sure

int i = 1;
int l = 2;
double d = 3;
char c1 = i;
char c2 = l;
char c3 = d;

is that what you meant?

john
 
J

John Dibling

can a signed 'int', 'long' or 'double' datatype be changed int 'char'
without using any standard library functions...

sudip

Sure, but you will have to use some function to do basically what
itoa() and sprintf() do. You might even have write that function
yourself. There is nothing magic in any of the standard library
functions, just code.

BTW - I am assuming you are trying to get a number formatted as a
string, as accomplished like this: sprintf( psz, "%i",
nNumberToFormat);

</dib>

John Dibling
email: dib@substitute_my_full_last_name_here.com
Witty banter omitted for your protection
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top