Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

dynamically allocate memory for linear array of n
integers,store some elements in it and find some of them

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is use of null pointer in c?

959


Where are c variables stored in memory?

1023


What is the difference between test design and test case design?

2030


c program to compute AREA under integral

2336


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2561


the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters

2234


Why can arithmetic operations not be performed on void pointers?

983


What is pointers in c with example?

1023


How important is structure in life?

1029


Explain how do you generate random numbers in c?

1043


What are 'near' and 'far' pointers?

983


What is scanf () in c?

1055


What is malloc and calloc?

1004


Can we use any name in place of argv and argc as command line arguments?

1012


the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b

2614