esteEste código esta mal y no se porque, quiero hacer un array[5]={1,2,3,4,5,6}array[5]={1,2,3,4,5,6}
y mostrarlo en pantalla.
this code is wrong and i don't know why, i wanna make an array[5]={1,2,3,4,5,6} and print it in screen.
int main(void){
int arr[5];
arr[0]=1;
arr[1]=2;
arr[2]=3;
arr[3]=4;
arr[4]=5;
arr[5]=6;
for(int i=0; i<=5; i++) cout<<arr[i]<<endl;
return 0;}
El programa se ejecuta, pero muestra esto:
position: 0 data: 1
position: 1 data: 2
position: 2 data: 3
position: 3 data: 4
position: 4 data: 5
position: 5 data: 0
position: 6 data: 4196822
position: 7 data: 0
position: 8 data: 0
position: 9 data: 0
position: 10 data: 0
position: 11 data: 0
position: 12 data: 4196822
position: 13 data: 0
position: 14 data: -982238395
position: 15 data: 27786
...