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 use of fflush() function?
Program to swap the any two elements in an array containing N number of elements?
1 Answers Bosch, Glenwood, Ugam Solutions,
Can one function call another?
How can I trap or ignore keyboard interrupts like control-c?
Combinations of fibanocci prime series
How many keywords (reserve words) are in c?
Can math operations be performed on a void pointer?
How to delete a node from linked list w/o using collectons?
How do I get a null pointer in my programs?
Using which language Test cases are added in .ptu file of RTRT unit testing???
What is the benefit of using #define to declare a constant?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.