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 |
Why is c platform dependent?
hat is a pointer?
What do you mean by invalid pointer arithmetic?
Which is the memory area not included in C program? give the reason
Given an array of length N containing integers between 1 and N, determine if it contains any duplicates.
What is string function c?
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
What is a union?
Is there any demerits of using pointer?
What is the condition that is applied with ?: Operator?
who is the father of C Language?
20 Answers CTS, UST,
swap 2 numbers without using third variable?