#problem with output

4 messages · Page 1 of 1 (latest)

fickle sky
#

hey all

i have this code, its not that complex, it seems right but it outputting randomness , heres the code


            int i;
            int i2;
            int choice;

            scanf("%d",&i2);
            scanf("%d",&choice);
            int int_array_1[i2];

            for(i=0;i<0;i++){
                int_array_1[i] = i;
            }


            switch(choice){
        case 1:
            for(i=0;i<i2;i++){
                printf("%d\n",int_array_1[i]);
                }
                break;
        case 2:
            for(i=i2-1;i>-1;i--){
                printf("%d\n",int_array_1[i]);
            }
            break;
        default:
            printf("default");

            }


wicked warrenBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

fickle sky
#

!solved

wicked warrenBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity