in doing C,

in my function OpenData, it takes a point to array in main, take command-line argument name, and arraysize pointer.

i get warning
passing arg of 'function' makes integer from pointer OR pointer from intgeger without a cast... what does it mean?

and i get con

int main(int argc, char*argv[]) 
{
   int array, randomNb, arraySize;
   int i, judge, iteration = 0;
   
   if (argc !=4)
   {
      fprintf (stderr, "This program requires following command");
      fprintf (stderr, " line arguments\n");
      fprintf (stderr, "'seed number', number of 'values' to be tested, ");
      fprintf (stderr, "and a 'file name'.\n");
      exit(-1);
   }
   
   OpenData(&array, argv[3], &arraySize);
.
.
.
void OpenData(int *arrayPtr, char file, int *arraySizePtr )
{
   FILE *ifp;
   int n;
   int i;
   ifp = fopen(file, "r");
   
   if(ifp == NULL)
   {
      fprintf(stderr, "can't open %s ... ...\n", file);
      exit(-2);
   }
   
  while(fscanf(ifp, "%d", &n) != EOF)
   { 
      *arraySizePtr++;
   }
   
   rewind(ifp);
   
   *arrayPtr = (int *) malloc (*arraySizePtr * sizeof(int));
   if (*arrayPtr == NULL)
   {
      fprintf(stderr, "Memory allocation failed... ...\n");
      exit (-3);
   }
   
   for (i=0; i<*arraySizePtr; i++)
   {
      fscanf(ifp, "%d", *arrayPtr[i]);   
   }
   fclose(ifp);
}

Already answered it on the C board, so I'm closing this thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.