dynamically allocate memory for linear array of n
integers,store some elements in it and find some of them
Answer / 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 |
What is the hardest programming language?
What is the use of pragma in embedded c?
Why c is a mother language?
#ifdef TRUE int I=0; #endif main() { int j=0; printf("%d %d\n",i,j); }
What is default value of global variable in c?
what is the use of macro program
Hi Every one...........I have been selected for the SBI Clerk. But i m one month Pregnanat. So anyone please suggest me, is they take any objection on my joining .
4 Answers State Bank Of India SBI,
Can u please send me the exam pattern and also Previous papers to javed123go@gmail.com
How can I manipulate individual bits?
What is malloc and calloc?
What is array in c with example?
What math functions are available for integers? For floating point?