Answer Posted / lp
Declare a integer array size at runtime:
1.declare an interget pointer. - int *ptr
2.Get the size of array from user - int n
3.using malloc() ,allocate that many number of location to
the pointer. - ptr = malloc(n*sizeof(int));
4.Make use of the dynamically allocated array. - ptr[]
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
What are actual arguments?
What's the best way of making my program efficient?
What is difference between Structure and Unions?
What is the difference between arrays and pointers?
Add Two Numbers Without Using the Addition Operator
Multiply an Integer Number by 2 Without Using Multiplication Operator
What is #include stdio h and #include conio h?
Can you subtract pointers from each other? Why would you?
Which header file is essential for using strcmp function?
Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?
How can I call a function with an argument list built up at run time?
What is atoi and atof in c?
application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above
Explain how can I open a file so that other programs can update it at the same time?
Is array a primitive data type in c?