Yeah i made a totally new program. However it still doesnt work. The error message says that it is an invaled conversion from int to int*. Here is the code. Please fix it and help repost it.

# include <stdio.h>
# include "simpio.h"
# include "genlib.h"
# define SIZE 500
void displayArray(int nArray[])
{
int arraynum;
printf("%d        ",nArray[arraynum]);
}


main()
{     
      int amount,count,num1,num2,result,arraynum;
      int nArray[arraynum];
      amount=GetInteger();
      count=amount;
      num1=count;
      num2=num1;
      result=1;
      arraynum=0;
      while(num2!=0)
      {
      while(num1!=0)
      {
      result=result*2;
      num1=num1-1;
      }
      displayArray(nArray[arraynum]);
      arraynum=arraynum+1;
      num2=num2-1;
      }
      getchar();
}

Your error message - did it tell you what line the error is on?

Because just guessing I would have to say its this line:

displayArray(nArray[arraynum]);

because nArray[arraynum] is an integer not an array of integers

Edited 7 Years Ago by gerard4143: n/a

Yeah my program crashes or gets really screwed up. It puts out an output, but that's cause i initialized it as 3. therefore arraynum=3. that number wont change. I need a way to initialize it, but swap the value of arraynum in the function with the one in the program. Here is my code

# include <stdio.h>
# include "simpio.h"
# include "genlib.h"
# define SIZE 500
void displayArray(int nArray[])
{
int arraynum;
arraynum=3;
printf("%d        ",nArray[arraynum]);
}


main()
{     
      int amount,count,num1,num2,result,arraynum;
      int nArray[arraynum];
      printf("whats the max amount of two's?");
      amount=GetInteger();
      count=amount;
      num1=count;
      num2=num1;
      result=1;
      arraynum=0;
      while(num2!=0)
      {
      while(num1!=0)
      {
      result=result*2;
      num1=num1-1;
      }
      displayArray(nArray);
      arraynum=arraynum+1;
      num2=num2-1;
      }
      getchar();
}

Edited 7 Years Ago by wangatang126: n/a

This article has been dead for over six months. Start a new discussion instead.