APPFS
Advanced practical programming for scientists
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
ex4_calloc.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <stdlib.h>
3
4
int
main
()
5
{
6
int
count = 0;
7
int
* p;
8
9
while
(NULL != (p =
malloc
(1024*1024*1024)))
10
{
11
for
(
int
i
= 0;
i
< 1024*1024;
i
++)
12
p[
i
* 1024 /
sizeof
(*p)] = 5;
13
14
count++;
15
printf(
"Got %4d GB\n"
, count);
16
}
17
printf(
"Out of memory after %d GB\n"
, count);
18
19
return
0;
20
}
malloc
#define malloc(a)
Definition:
mshell.h:53
main
int main()
Definition:
ex4_calloc.c:4
i
int i
Definition:
ex4_struct.c:4
Generated on Sun Nov 16 2014 23:14:05 for APPFS by
1.8.6