0

In my program, I am currently trying to store a string from an array into another array so I can then have that saved to output later.

if(score1 == 3)
            {
                printf("\n\n%s adavances to the next round!",names[i]);
                strncpy(winner[i], names[i], 10);
                printf("\n\nPress Enter to Continue");
                getch();
                system("cls");
                break;

That is currently how I am trying to store the array

for(p = 0; p > 8; p++)
    {
        for(c = 0; c > 8; c++)
        {
            printf("%c",winner[p][c]);
        }

    }    

And that is how i am currently trying to output the array, but when i get to the screen with the output nothing is happening.

4
  • 1
    What do you mean, "store?" you are printing the value.?? Commented Nov 20, 2015 at 3:03
  • Which is the "other" array? Commented Nov 20, 2015 at 3:05
  • The reason am I storing it because I am making another function that will be able to print the results from each round (this round being the first) Commented Nov 20, 2015 at 3:07
  • Winner is the other array, names[i] is the array i want copied Commented Nov 20, 2015 at 3:08

1 Answer 1

1

First off, neither of the loops will run even once :

for(p = 0; p > 8; p++)

or

for(c = 0; c > 8; c++)

as p & c is never greater than 8

That's one observation. To help you out, we might need additional info like how is the array declared, etc.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the help! Sorry I was a bit ignorance, just started learning.
For your earlier comment, easiest way is to use printf("\n"); outside the inner loop

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.