Je cherche a comprendre pourquoi cet utilisation de malloc fonctionne, mais ne devrait pourtant pas fonctionner?
Si j'arrête la boucle a 36 ou +, là par contre sa ne fonctionne plus, des explication?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { unsigned int entry_start; unsigned int entry_end; }ENTRY; int main(int argc, char *argv[]) { ENTRY *file_entry; int i; file_entry = malloc(0); for (i=0;i<35;i++) { file_entry[i].entry_start = i; file_entry[i].entry_end = i+1; } for (i=0;i<35;i++) { printf("entry start : %d entry end : %d\n", file_entry[i].entry_start, file_entry[i].entry_end ); } system("PAUSE"); return 0; }
Partager