Answer Posted / nithin
int main()
{
int i, max;
// Array
int *a;
printf("Enter the size of array\n");
scanf("%d", &max);
//Run time size allocation of an array
a = (int*)malloc(max * sizeof(int));
for(i = 0; i < max;i++)
{
a[i] = i * 2;
printf("value of element %d is %d\n", i, a
[i]);
}
return 0;
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }
Explain what does it mean when a pointer is used in an if statement?
How can I remove the trailing spaces from a string?
Where in memory are my variables stored?
Can you apply link and association interchangeably?
What is getch?
What is the explanation for prototype function in c?
What is the difference between mpi and openmp?
What is the value of h?
How to delete a node from linked list w/o using collectons?
What do you mean by command line argument?
Explain how can I manipulate strings of multibyte characters?
What is pass by reference in c?
What is operator promotion?
what is the structure pointer?