dynamically allocate memory for linear array of n
integers,store some elements in it and find some of them
Answer Posted / vignesh1988i
#include<stdio.h>
#include<conio.h>
#include<alloc.h>
void main()
{
int *pointer,m,sum=0;
printf("enter the no. of elemrnts going to be entered :");
scanf("%d",&m);
pointer=(int*)malloc(m*sizeof(int));
for(int i=0;i<m;i++)
scanf("%d",(pointer+i));
for(i=0;i<m;i++)
sum=sum+(*(pointer+i));
for(i=0;i<m;i++)
printf("\n%d",sum);
getch();
}
thank u
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
what do you mean by enumeration constant?
Why is extern used in c?
What is string in c language?
What is const volatile variable in c?
What is indirection in c?
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
What is pointer to pointer in c with example?
What is the purpose of realloc()?
What are multibyte characters?
What is the use of sizeof () in c?
What is wrong with this statement? Myname = 'robin';
Explain what is dynamic data structure?
what is the height of tree if leaf node is at level 3. please explain
write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?