dynamically allocate memory for linear array of n
integers,store some elements in it and find some of them
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 |
Is a pointer a kind of array?
write a C code to reverse a string using a recursive function, without swapping or using an extra memory.
9 Answers Motorola, TCS, Wipro,
what is y value of the code if input x=10 y=5; if (x==10) else if(x==9) elae y=8; a.9 b.8 c.6 d.7
What are the types of pointers?
control 50 devices which has 2 states on and off.using bitwise operator.plz answer it its urgent
What is function in c with example?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it.
When should a type cast be used?
Is there something we can do in C but not in C++? Declare variable names that are keywords in C++ but not C.
Find greatest number out of 10 number without using loop.
what is the difference between <stdio.h> and "stdio.h"
14 Answers Invendis, Kanbay, Mastek, MathWorks,
what is difference between getchar,putchar functions and printf and scanf function? does putchar show output only when input given to it