compiling cuda code

I am a new CUDA user. I am trying to compile this program, but I am receiving the following errors:

test3.cu(31): error: variable “i” is not a template

test3.cu(31): error: expected a “>”

test3.cu(31): error: expected a “;”

3 errors detected in the compilation of “/tmp/tmpxft_000037bf_00000000-4_test3.cpp1.ii”.

this is line 31 for (int i=0, i<SIZE; i++)

Can anyone please help? Thank you.

global void vecAdd(float* A, float* B, float* C)

{

int i = threadIdx.x;

A[i]=0;

B[i]=i;

C[i]=A[i] + B[i];

}

#include<stdio.h>

#include<stdlib.h>

#include<cuda.h>

#define SIZE 10

int main()

{

int N=SIZE;

float A, B, C;

float *devPtrA;

float *devPtrB;

float *devPtrC;

int memsize=SIZE * sizeof(float);

cudaMalloc((void**)&devPtrA, memsize);

cudaMalloc((void**)&devPtrB, memsize);

cudaMalloc((void**)&devPtrC, memsize);

cudaMemcpy(devPtrA, A, memsize, cudaMemcpyHostToDevice);

cudaMemcpy(devPtrB, B, memsize, cudaMemcpyHostToDevice);

//global functions are called: Func<<< Dg, Db, Ns >>>(parameter);

vecAdd<<<1, N>>>(devPtrA, devPtrB, devPtrC);

cudaMemcpy(C, devPtrC, memsize, cudaMemcpyHostToDevice);

for (int i=0, i<SIZE; i++)

printf(“C[%d]=%f\n”,i,C[i]);

cudaFree(devPtrA);

 cudaFree(devPtrA);

 cudaFree(devPtrA);

}

[codebox]

for (int i=0, i<SIZE; i++)

[/codebox]

should read

[codebox]

for (int i=0; i<SIZE; i++)

[/codebox]

You need a ; after initializing the loop counter.