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 |
Difference between Class and Struct.
13 Answers Ericsson, Motorola, Wipro,
Explain why c is faster than c++?
How can you tell whether a program was compiled using c versus c++?
What is the difference between macros and inline functions?
What is advantage of pointer in c?
What is the use of gets and puts?
What is the best way to store flag values in a program?
Where is volatile variable stored?
write a program of palindrome(madam=madam) using pointer?
How to receive strings with spaces in scanf()
What is difference between stdio h and conio h?
sum of two integers values only other then integer it should print invalid input.