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



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

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

Post New Answer

More C Interview Questions

what is the use of fflush() function?

2 Answers  


Program to swap the any two elements in an array containing N number of elements?

1 Answers   Bosch, Glenwood, Ugam Solutions,


Can one function call another?

0 Answers  


How can I trap or ignore keyboard interrupts like control-c?

0 Answers  


Combinations of fibanocci prime series

0 Answers  


How many keywords (reserve words) are in c?

0 Answers  


Can math operations be performed on a void pointer?

0 Answers  


How to delete a node from linked list w/o using collectons?

0 Answers   Zycus Infotech,


How do I get a null pointer in my programs?

0 Answers  


Using which language Test cases are added in .ptu file of RTRT unit testing???

0 Answers  


What is the benefit of using #define to declare a constant?

0 Answers  


Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.

0 Answers  


Categories