Click here to Skip to main content
16,019,614 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C
#include<stdio.h>
#include<stdlib.h>


int main()
{
        int Luckynumbers[] = {6,4,98,97,106,54,54};
        int i;

        for(i=0; i<=5; i++)
        {
                printf("%d\n",Luckynumbers[i]);
        }
        return 0;
}


What I have tried:

how to solve these i was tried number of times but i am unable to identify these please try to solve these problem.
Posted
Updated 3-Apr-22 19:54pm
v2

1 solution

The code you show us doesn't show the error you describe.
If I run your code through an online IDE:
C
#include<stdio.h>
#include<stdlib.h>


int main()
{
        int Luckynumbers[] = {6,4,98,97,106,54,54};
        int i;

        for(i=0; i<=5; i++)
        {
                printf("%d\n",Luckynumbers[i]);
        }
        return 0;
}
And run it, I get the expected output:
6
4
98
97
106
54


...Program finished with exit code 0
Press ENTER to exit console.
I suspect that you compiling the wrong file!
 
Share this answer
 
Comments
Nagavarapu Pavan 4-Apr-22 1:57am    
i am using linux
OriginalGriff 4-Apr-22 2:13am    
So does the online compiler I'm using, I believe ... what do you think that has to do with a syntax error in a different file? :D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900