changing datatypes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sudip chatterjee

    changing datatypes

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

    sudip
  • John Harrison

    #2
    Re: changing datatypes


    "sudip chatterjee" <monarchofindia @hotmail.com> wrote in message
    news:828df4f5.0 307230919.391ba 559@posting.goo gle.com...[color=blue]
    > can a signed 'int', 'long' or 'double' datatype be changed int 'char'
    > without using any standard library functions...
    >
    > sudip[/color]

    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


    Comment

    • John Harrison

      #3
      Re: changing datatypes

      >[color=blue]
      > int i = 1;
      > int l = 2;[/color]

      I meant to type

      long l = 2;

      john


      Comment

      • John Dibling

        #4
        Re: changing datatypes

        On 23 Jul 2003 10:19:44 -0700, monarchofindia@ hotmail.com (sudip
        chatterjee) wrote:
        [color=blue]
        >can a signed 'int', 'long' or 'double' datatype be changed int 'char'
        >without using any standard library functions...
        >
        >sudip[/color]

        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_na me_here.com
        Witty banter omitted for your protection

        Comment

        Working...