[ create a new paste ] login | about

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

C, pasted on Mar 5:
#include <stdio.h>
#include <stdlib.h>

int *a(int n){
int *f,i;

f = (int*)malloc(sizeof(int) * n);

for(i=0;i<n;i++) f[i]=i*i;

return f;
}

int main(){
int *f,i,n;
n=10;

f = a(n);

for(i=0;i<n;i++) printf("%d %d\n",i,f[i]);

free(f);return 0;
}


Output:
1
2
3
4
5
6
7
8
9
10
11
0 0
1 1
2 4
3 9
4 16
5 25
6 36
7 49
8 64
9 81



Create a new paste based on this one


Comments: