]>
Commit | Line | Data |
---|---|---|
1 | /*dkf5k*/ | |
2 | #include <stdlib.h> | |
3 | #include <stdio.h> | |
4 | ||
5 | int main() | |
6 | { | |
7 | char buffer[12] = "hello world"; | |
8 | int i; | |
9 | printf("Enter the character you want: "); | |
10 | scanf("%i", &i); | |
11 | if ( i >= sizeof(buffer)) | |
12 | { | |
13 | fprintf(stderr, "Error: %i is greater than or equal to the range which is %i", i, sizeof(buffer)); | |
14 | exit(0); | |
15 | } | |
16 | printf("You asked for character %i which is %c", i, buffer[i]); | |
17 | return 0; | |
18 | } |