Binary operator oprand missing

I am faced by this silly problem

Error: < Error: Symbol arrSize is not defined in current scope test.C:
Error: Binary operator oprand missing test.C:
*** Interpreter error recovered ***

and I am using Root 5.20/00


#include <vector>
using namespace std;

#define NMOD 1
#define NCHMOD 1536
#define NCHAN 128
#define NCHIP 12

int disableCompaBit (int det, int mod) {
  char *fbad = "/home/Desktop/badChannel/data/noise_mod0.raw";
  char *ftrim_r= "/home/Desktop/badChannel/6modTrim/noise.snf00";
  char *ftrim = "/home/Desktop/badChannel/6modTrim/CompaCorr/noise.snf";
  char *ftrim_w[256];

  char line[100];
  char line_bad[80];
  vector<int> vec_bad;
  int badChan;
  int trimVal, compa, nil0, nil1, nil2, nil3;
  int chanPos, chan;
  int channel[NCHIP*NCHAN];
  bool flag;
  FILE *fb_r = fopen(fbad,"r");
  if(fb_r ==NULL) {
    printf("Could not read file %s\n",fbad);
    return -1;

  while (fgets(line_bad, 80, fb_r) != NULL)  {
    sscanf(line_bad, "%d",&badChan);
  const int size = vec_bad.size();
  int bad[size];
  printf("vec_bad has %d elements\n", vec_bad.size());
  for(int j=0; j<size; j++) {
    bad[j] = vec_bad[j];
    //printf("bad[%d] %d\n", j, bad[j])
  sprintf(ftrim_w, "%s%d%d",ftrim, det, mod);
  FILE *ft_w = fopen(ftrim_w,"w");
  if(ft_w==NULL) {
    printf("Could not write file %s\n",ftrim_w);
    return -1;

  FILE *ft_r = fopen(ftrim_r, "r");
  if(ft_r == NULL) {
    printf("Could not read file %s\n",ftrim_r);
    return -1;
  for(int i=0; i<6; i++) {
    if(fgets(line, 256, ft_r) != NULL) {
    }else {
        printf("\n\n error reading initialization file: dac %d  not found !!\n\n",i);
        return -1;
  for(int ichip=0; ichip<NCHIP; ichip++) {
    if(fgets (line, 256, ft_r) != NULL) {
     fprintf(ft_w, "%s", line);
    }else {
      printf("\n\n error reading initialization file: outbuffEnable %i not found !!\n\n",ichip);
      return -1;

    for(int ichan=0; ichan<NCHAN; ichan++) {
      if(fgets(line, 256, ft_r)!=NULL) {
       //printf("%s", line);
       sscanf(line,"%d %d %d %d %d %d", &trimVal, &compa, &nil0, &nil1, &nil2, &nil3);
      chanPos= ichan+((NCHAN*ichip*(mod+1))+(mod*NCHAN));
      channel [chanPos]= chanPos;
      if(item_exists(channel[chanPos], bad, size) ) { //problem arises here
        printf("chanPos &d compa %d\n", channel[chanPos],compa);
      }else {
        printf("chanPos &d compa %d\n", channel[chanPos],compa);

  return 0;

bool item_exists(int item, int[] array, int arrSize) { //problem arises here
  for(int k=0; k < arrSize; k++) { //problem arises here
     if(array[k] == item) 
       return true;
  return false;

thanks in advance for the help

Correct all problems that you get reported when you try to:
root [0] .L test.C++
or even better:
root-config --cxx --cflags -O2 -W -Wall -c test.C

thank you