i have to convert a program from c++ to C language and at one point in my program im stuck where its dealing with dynamic memory of an array. i started it but i dont know how u do dynamic memomory in c language.

if (reply == '1')
      printf("Enter the 1st score (any invalid score to quit): ");
      scanf("%d", score);
      while (score >= 0 && score <= 100)
         if (numOfScores > arraySize)
            arraySize = int(1.5*arraySize + 1);
            scoresArrayPtrHold = scoresArrayPtr;
            scoresArrayPtr = new int [arraySize];
            for (int i = 0; i < numOfScores - 1; ++i)
               *(scoresArrayPtr + i) = *(scoresArrayPtrHold + i);
            scoresArrayPtrHold = 0;
         *(scoresArrayPtr + numOfScores - 1) = score;

         printf("Enter the next score (any invalid score to end): ");
         scanf("%d", score);

search for the malloc, calloc, realloc functions.

you'll find good tutorials on this site itself

how do i get to the tutoriols

man is your friend...

(*hint man malloc)

And don't forget free() , which I'm sure is mentioned in the tutorial.

Be a part of the DaniWeb community

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