Modified to send

+- StateUtilities_LogN.c
This commit is contained in:
Charles Descamps 2023-09-16 20:07:59 -07:00
parent 7cebe82132
commit cabae23450

View file

@ -33,21 +33,21 @@ void addElementFromData( StateArrayType *stateArr,
double stateGrowth, char politicalMajority )
{
printf("\nAdding Element(from data)\n");
printf("\nSize is: %d\n", &stateArr->size);
printf("\nCapacity is: %d\n", &stateArr->capacity);
printf("\nSize is: %d\n", stateArr.size);
printf("\nCapacity is: %d\n", stateArr.capacity);
// check to see if the size will go over the capacity
if(&stateArr->size < &stateArr->capacity)
if(stateArr.size < stateArr.capacity)
{
printf("\nInside IF\n");
// put in the data to the array
// stateArr->array[stateArr.size] = parameter
stateArr->array[&stateArr->size].population = statePop;
stateArr->array[&stateArr->size].growth = stateGrowth;
stateArr->array[&stateArr->size].majority = politicalMajority;
stateArr->array[stateArr.size].population = statePop;
stateArr->array[stateArr.size].growth = stateGrowth;
stateArr->array[stateArr.size].majority = politicalMajority;
// use strcpy(stateArr->array[stateArr.size].name, stateName)
strcpy(stateArr->array[&stateArr->size].name, stateName);
strcpy(stateArr->array[stateArr.size].name, stateName);
// increment size (stateArr.size = stateArr.size + 1)
&stateArr->size = &stateArr->size + 1;
stateArr->size = stateArr->size + 1;
printf("\nDONE IF\n");
}
// no return, void