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)
{
++numOfScores;
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);
free(scoresArrayPtrHold);
scoresArrayPtrHold = 0;
}
*(scoresArrayPtr + numOfScores - 1) = score;
printf("Enter the next score (any invalid score to end): ");
scanf("%d", score);
}