Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void initArrays(float* x, float* y,int N){
- for(int i=0;i<N;i++){
- x[i] = 1;
- y[i] = 2;
- }
- }
- void addArrays(float*x,float* y,int N){
- for(int i=0;i<N;i++)
- y[i] = x[i] + y[i];
- }
- int main(void)
- {
- int N = 1<<20;
- float *x, *y;
- x = (float*)malloc(N*sizeof(float));
- y = (float*)malloc(N*sizeof(float));
- initArrays(x,y,N);
- addArrays(x,y,N);
- free(x);
- free(y);
- }
Add Comment
Please, Sign In to add comment