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
Which is better between malloc and calloc?
write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)
Sir i need notes for structure,functions,pointers in c language can you help me please
What are the disadvantages of a shell structure?
what type of questions arrive in interview over c programming?
How can I automatically locate a programs configuration files in the same directory as the executable?
List the difference between a "copy constructor" and a "assignment operator"?
What is getch () for?
What do you mean by Recursion Function?
What is string in c language?
What does c mean in basketball?
Which node is more powerful and can handle local information processing or graphics processing?
.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }
What is masking?
Simplify the program segment if X = B then C ← true else C ← false