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 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.