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 are the 4 types of functions?

1061


Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)

1160


What is pass by reference in functions?

850


What is getch?

1195


Is main is user defined function?

1156


What is the stack in c?

1157


What is adt in c programming?

1169


What is the auto keyword good for?

1159


When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

1988


What is the use of c language in real life?

1028


Write a Program to find whether the given number or string is palindrome.

1281


Write a program to print factorial of given number using recursion?

1020


show how link list can be used to repersent the following polynomial i) 5x+2

2315


How can you increase the size of a dynamically allocated array?

1193


How is null defined in c?

1157