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 associativity of bitwise OR operator?

1 Answers  


what is void pointer?

1 Answers   Wipro,


print 1-50 with two loop & two print Statement

2 Answers  


What is the easiest sorting method to use?

0 Answers  


What is else if ladder?

0 Answers  


What is difference between the following 2 lines…. int temp = (int)(0x00); int temp = (0x00int);

3 Answers   Bosch,


What is the output of the following program main();{printf ("chennai""superkings"}; a. Chennai b. superkings c. error d. Chennai superkings

6 Answers  


what are the general concepts of c and c++

2 Answers  


How many ways are there to swap two numbers without using temporary variable? Give the each logic.

9 Answers  


How many types of errors are there in c language? Explain

0 Answers  


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?

0 Answers  


Categories