Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can I set an array's size at run time?

Answer Posted / vinod

C99 and above supports the conceptof VLA(Variable Length Array) which allows you to set array size based on input during run time. It can also done using dynamic memory allocation.

Example:
int main()
{
int i;
scanf("%d",&i);
int a[i];
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are comments included during the compilation stage and placed in the EXE file as well?

1088


develop algorithms to add polynomials (i) in one variable

2175


explain how do you use macro?

1166


What are the keywords in c?

1129


Hi can anyone tell what is a start up code?

2086


How can I get the current date or time of day in a c program?

1229


What is the purpose of clrscr () printf () and getch ()?

1073


What is data type long in c?

1078


When should the register modifier be used? Does it really help?

973


application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above

1072


What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?

1251


What is a built-in function in C?

1609


How can you invoke another program from within a C program?

1079


How do we declare variables in c?

1073


Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

1910