SHOW:
|
|
- or go back to the newest paste.
1 | #include <stdio.h> | |
2 | #include <stdlib.h> | |
3 | ||
4 | int main(void) | |
5 | { | |
6 | int *zahlen; | |
7 | - | //int i =0; |
7 | + | unsigned int len; |
8 | unsigned int i; | |
9 | - | int len; |
9 | + | |
10 | printf("Bitte anzahl der Werte eingeben\n"); | |
11 | - | scanf("%d",&len); |
11 | + | scanf("%u",&len); |
12 | getchar(); | |
13 | ||
14 | - | for(int i=0; i<len; i++) |
14 | + | |
15 | - | { |
15 | + | if (zahlen==NULL) { |
16 | perror("Fehler beim Speicher reservieren: "); | |
17 | return 1; | |
18 | } | |
19 | ||
20 | - | if (zahlen==NULL) |
20 | + | for(i = 0; i < len; i++) { |
21 | - | { |
21 | + | |
22 | - | printf("Fehler beim Speicher reservieren!"); |
22 | + | |
23 | getchar(); | |
24 | } | |
25 | - | for(int i=0; i<len; i++) |
25 | + | |
26 | - | { |
26 | + | for(int i=0; i<len; i++) { |
27 | printf(",%d",zahlen[i]); | |
28 | } | |
29 | ||
30 | free(zahlen); | |
31 | return 0; | |
32 | } |