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

The file stdio.h, what does it contain?

1155


Explain what are binary trees?

1075


Why main is used in c?

1072


How can I find the modification date of a file?

1279


What is a list in c?

1030


What are the uses of a pointer?

1151


What type of function is main ()?

1039


What is assert and when would I use it?

1003


What is pointer to pointer in c language?

1141


When should the register modifier be used? Does it really help?

963


In C language, a variable name cannot contain?

1274


What is character constants?

1179


What is a double c?

981


What is static volatile in c?

1019


What are c identifiers?

1087