
December 12th, 2012, 03:21 PM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 2
Time spent in forums: 45 m 10 sec
Reputation Power: 0
|
|
|
-858993460 Value when use prinft, please help
Hi, i'm starting with my course of Structured programming and i'm programming in C, so, here i am in Microsoft Visual C++ 2010 making this program of print an array of 20 numbers in order and backwards, but when the backward array is printed it shows "-858993460" in the first value and i don't know why the program do this, i would like you to help me to solve this and a little explanation of why and what can i do for avoid it in the future.
Here is the code and the result:
Code:
#include <stdio.h>
#include <conio.h>
int main()
{
int Items[20];
int i;
puts("introduce 20 numbers, followed by return");
for (i=0; i<20; i++)
scanf("%d", &Items[i]);
for (i=0; i<20; i++)
printf("%d ",Items[i]);
printf("\n");
for (i=20; i>0; i--)
printf("%d ",Items[i]);
getchar();
getchar();
return 0;
}
and here is the result
Photo Result
EDIT: I don't know why the photo of the results is not showing but it's something like
Code:
Introduce 20 numbers followed by return
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
-858993460 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2
debugged in cmd
|