Hi guys,
I'm on the arrays tutorial and I'm playing around with them. I've wrote the following program to store the input in an array then retrive the 3rd value and display it but when I compile and run it in Dev C++ I get
An access violation (segmentation fault) raised in program
And with gcc in a command line
Enter a Word rytyrt
9 [main] array 5728 _cygtls::handle_exceptions: Exception: STATUS_ACCESS_V
IOLATION
991 [main] array 5728 open_stackdumpfile: Dumping stack trace to array.exe.s
tackdump
45255 [main] array 5728 _cygtls::handle_exceptions: Exception: STATUS_ACCESS_V
IOLATION
47921 [main] array 5728 _cygtls::handle_exceptions: Error while dumping state
(probably corrupted stack)
Heres the code
Code:
#include <stdio.h>
int main()
{
char array[10];
printf("Enter a Word");
scanf("%s", array[10]);
printf("The 3rd letter is %s", array[3]);
getchar();
getchar();
return 0;
}
Any ideas, thanks