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 a stream?

1093


What are the two types of functions in c?

964


What is bash c?

964


How can I change the size of the dynamically allocated array?

1114


Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?

1093


Explain the use of #pragma exit?

1141


What are formal parameters?

1075


How can this be legal c?

1059


Differentiate Source Codes from Object Codes

1496


Can a file other than a .h file be included with #include?

1113


What is a program flowchart and how does it help in writing a program?

1097


What is c language in simple words?

1028


What is a buffer in c?

958


What is 2 d array in c?

978


Tell me when is a void pointer used?

1122