I just took the second lesson of second week, we were taught how to do dynamic integer array, some confusions i need to clear up is when we have initialized an integer and even take the value from user won't it become static for program ? I mean take value from user at run time is dynamic ? Can't we do a program which itself acknowledge how many values it needs ? What we do if the user itself doesn't know how much students are coming in the class, what if user enter i'll enter 3 ages for the students and then there is another one?
int n;
do
{
printf("No of people in room: ");
n = GetInt(); //we'll get the value from user
}
while(n<1);
int ages[size];
printf("Age of a person: ", i + 1);
for(int i=0; i<n; i++)
{
printf("A year from now person %i will be %i year old, i+ 1",ages[ i ]);
}