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 do you mean by enumeration constant?

1013


Why is extern used in c?

1093


What is string in c language?

1161


What is const volatile variable in c?

1035


What is indirection in c?

1071


how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software

3320


What is pointer to pointer in c with example?

1074


What is the purpose of realloc()?

1146


What are multibyte characters?

1126


What is the use of sizeof () in c?

1054


What is wrong with this statement? Myname = 'robin';

1327


Explain what is dynamic data structure?

1169


what is the height of tree if leaf node is at level 3. please explain

2153


write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list

2808


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

1070