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
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
Write a program to print “hello world” without using semicolon?
show how link list can be used to repersent the following polynomial i) 5x+2
write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.
List the difference between a 'copy constructor' and a 'assignment operator' in C?
Write a progarm to find the length of string using switch case?
What is ambagious result in C? explain with an example.
What is signed and unsigned?
Explain what are compound statements?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
Differentiate between calloc and malloc.
What is array within structure?
What is the basic structure of c?