Thread: assigning an string of arrays by loop

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jul 2022
    Posts
    78
    so, at the moment


    Code:
        int i;
    
    
        int int1[10];
        char chara1[10][10];
        char chara2[10][10];
    
    
        for(i=0;i<10;i++){
    
    
            int1[i] = i;
            itoa(int1[i],chara1[i],26);
    
    
            strcat(chara1[i],chara1[i-1]);
    
    
    
    
    
    
    
    
            printf("%s\n",chara1[i]);
    
    
    
    
        }
    outputs

    0
    10
    210
    3210
    43210
    543210
    6543210
    76543210
    876543210
    9876543210




    which is backwards lol

    its supposed to output

    0
    01
    012
    0123
    01234
    012345
    0123456
    01234567
    012345678
    0123456789
    Last edited by WaterSerpentM; 1 Week Ago at 04:53 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with assigning character arrays
    By KSG XII in forum C Programming
    Replies: 7
    Last Post: 04-05-2015, 04:04 PM
  2. Replies: 3
    Last Post: 07-01-2014, 07:48 AM
  3. assigning 2D arrays to pointers
    By rakeshkool27 in forum C Programming
    Replies: 5
    Last Post: 01-19-2010, 12:34 AM
  4. trouble assigning arrays
    By shintaro in forum C++ Programming
    Replies: 8
    Last Post: 11-21-2008, 08:31 AM
  5. Assigning values to arrays
    By napkin111 in forum C++ Programming
    Replies: 7
    Last Post: 02-26-2003, 08:52 PM

Tags for this Thread