changing datatypes

Discussion in 'C++' started by sudip chatterjee, Jul 23, 2003.

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

    sudip
     
    sudip chatterjee, Jul 23, 2003
    #1
    1. Advertising

  2. "sudip chatterjee" <> wrote in message
    news:...
    > 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
     
    John Harrison, Jul 23, 2003
    #2
    1. Advertising

  3. sudip chatterjee

    John Dibling Guest

    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
     
    John Dibling, Jul 23, 2003
    #3
  4. >
    > int i = 1;
    > int l = 2;


    I meant to type

    long l = 2;

    john
     
    John Harrison, Jul 23, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    2
    Views:
    546
    Yan-Hong Huang[MSFT]
    Jul 28, 2003
  2. =?Utf-8?B?UGF1cmF2aQ==?=

    Problem while reading excel file with mix datatypes

    =?Utf-8?B?UGF1cmF2aQ==?=, Mar 2, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    579
    Alvin Bruney [MVP]
    Mar 4, 2004
  3. .Net Sports
    Replies:
    1
    Views:
    706
    John Rivers
    Aug 31, 2005
  4. Mark
    Replies:
    2
    Views:
    1,065
  5. Ashish

    complex datatypes in webservices.

    Ashish, Dec 19, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    322
    Joshua Flanagan
    Dec 19, 2005
Loading...

Share This Page