Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > changing datatypes

Reply
Thread Tools

changing datatypes

 
 
sudip chatterjee
Guest
Posts: n/a
 
      07-23-2003
can a signed 'int', 'long' or 'double' datatype be changed int 'char'
without using any standard library functions...

sudip
 
Reply With Quote
 
 
 
 
John Harrison
Guest
Posts: n/a
 
      07-23-2003

"sudip chatterjee" <> wrote in message
news: om...
> 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


 
Reply With Quote
 
 
 
 
John Dibling
Guest
Posts: n/a
 
      07-23-2003
On 23 Jul 2003 10:19:44 -0700, (sudip
chatterjee) wrote:

>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
 
Reply With Quote
 
John Harrison
Guest
Posts: n/a
 
      07-23-2003
>
> int i = 1;
> int l = 2;


I meant to type

long l = 2;

john


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
complex datatypes in webservices. Ashish ASP .Net 1 12-19-2005 07:51 PM
text box and SqlDecimal datatypes Mark ASP .Net 2 11-07-2005 05:34 PM
Specified cast not valid on decimal & double datatypes .Net Sports ASP .Net 1 08-31-2005 09:11 AM
Problem while reading excel file with mix datatypes =?Utf-8?B?UGF1cmF2aQ==?= ASP .Net 1 03-04-2004 03:11 AM
interrogating database for field names/datatypes? ASP .Net 2 07-28-2003 01:39 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57