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 associativity of bitwise OR operator?
what is void pointer?
print 1-50 with two loop & two print Statement
What is the easiest sorting method to use?
What is else if ladder?
What is difference between the following 2 lines…. int temp = (int)(0x00); int temp = (0x00int);
What is the output of the following program main();{printf ("chennai""superkings"}; a. Chennai b. superkings c. error d. Chennai superkings
what are the general concepts of c and c++
How many ways are there to swap two numbers without using temporary variable? Give the each logic.
How many types of errors are there in c language? Explain
what are bit fields? What is the use of bit fields in a structure declaration?
0 Answers Flextronics, TISL, Virtusa,
What is wrong with this declaration?