i get command-line arguments
argv[3], but i need to pass it to function...

the sample input would be
a.out 7 100 lychrel.dat

int main(int argc, char*argv[]) 
{
   int *array, randomNb, arraySize;
   int i, judge, counter = 0, iteration = 0;
   
   int total;
   
   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);
   }

   char fileName[SIZE];
   fileName = argv[3];
   OpenData(&array, fileName, &arraySize);

Does line 17 and 18 coorect?

Recommended Answers

All 2 Replies

line 18 doesn't work anyway. you can't assign c-style arrays like that, but use strcpy() to do it. Do it like Salem suggested and you can just simply delete lines 17 and 18.

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.