int to string in C
Results 1 to 3 of 3

Thread: int to string in C

  1. #1
    Junior Member
    Join Date
    May 2004
    Posts
    23

    int to string in C

    Say u have int i=90 and char str[2], where str[] is an array of chars ( aka string), would u recommend using memset or memccpy (from string.h&gt to make a string from an integer.
    In my program, int can be any random number ( not a particular range of numbers) so u cant necessarily create a lookup table and use strcpy().

    please get back asap cos its due this Friday.

    cheers

  2. #2
    Custom User
    Join Date
    Oct 2001
    Posts
    503
    I would use itoa(...) to convert an integer to a string in C:

    http://www.mkssoftware.com/docs/man3/itoa.3.asp

    ac

  3. #3
    Ninja Code Monkey
    Join Date
    Nov 2001
    Location
    Washington State
    Posts
    1,027
    I would learn how to use google and how to do proper research so I could do my own homework.
    "When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
    "There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
    "Mischief my ass, you are an unethical moron." - chsh
    Blog of X

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides