this is a program explained in tuto 35.
however it gives error.let me write the program first.

#include "stdafx.h"



#include <iostream>
using namespace std;
void printArray(int theArray[], int sizeOfArray);

int main()
{
int alam[3] = {20,64,58};
int jalib[6]={54,24,7,8,9,99};

printArray(jalib,6);
}
void printArray(int theArray[], int sizeOfArray){

for (int x =0;x < sizeOfArray;x++){}
cout << theArray[x] << endl;
}

so the error is in the line cout << theArray[x] << endl;
the error is : "x is undefined"
why so ? how to solve it?