[ create a new paste ] login | about

Link: http://codepad.org/WqmSxMHq    [ raw code | output | fork ]

C, pasted on Nov 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int i ;
	void *p ;
	p = malloc ( sizeof(int)*10 ) ;

	for ( i = 0 ; i < 10 ; i++ ){
		*((int*)p+i) = i ;
	}

	for ( i = 0 ; i < 10 ; i++ ){
		printf ( "%d\n", ((int*)p)[i] ) ;
	}

	free (p) ;

	return 0 ;
}


Output:
1
2
3
4
5
6
7
8
9
10
0
1
2
3
4
5
6
7
8
9


Create a new paste based on this one


Comments: