Thread: Covert int array to char array in C.

  1. #1
    Registered User
    Join Date
    Aug 2015

    Covert int array to char array in C.

    I wish to convert integer array to a character array.


    void main()

    int i,temp[512];

    temp[i] = i+1;


    How to convert temp array to a character array?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Well, take your example, but modified to be an array of just 4 integers:
    int main(void)
        int i, temp[4];
        for (i = 0; i < 4; i++)
            temp[i] = i + 500;
        return 0;
    So, you have an array of integers 500, 501, 502 and 503. What does the resulting character array look like?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 09-25-2014, 06:12 AM
  2. Replies: 2
    Last Post: 09-25-2014, 04:03 AM
  3. Replies: 2
    Last Post: 03-20-2012, 08:41 AM
  4. Replies: 3
    Last Post: 11-17-2008, 12:36 PM
  5. how to covert 'std::string' to 'char * in c++
    By chintugavali in forum C++ Programming
    Replies: 11
    Last Post: 02-13-2008, 02:11 AM

Tags for this Thread