#include
main()
{
int *p, *c, i;
i = 5;
p = (int*) (malloc(sizeof(i)));
printf("
%d",*p);
*p = 10;
printf("
%d %d",i,*p);
c = (int*) calloc(2);
printf("
%d
",*c);
}



#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d"..

Answer / Nagender Choudhary

These lines of code dynamically allocate memory for an integer variable using malloc() and calloc(). The * operator is used to dereference the pointer, allowing it to be assigned a value. The fclose() function is used to close the file pointer.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above

1 Answers  


LOGIC OF Bodmas?

1 Answers  


Can main () be called recursively?

1 Answers  


True or false: If you continuously increment a variable, it will become negative? 1) True 2) False 3) It depends on the variable type

7 Answers  


main() { int x, arr[8]={11,22,33,44,55,66,77,88}; x=(arr+2)[3]; printf(ā€œ%dā€,x); }

8 Answers   Vector,


What is #include conio h?

1 Answers  


4)What would be the output? main() { int num=425; pf("%d",pf("%d",num)); } a)Comp error b)4425 c)4253 d)3435 e)none

10 Answers  


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

1 Answers  


How can I ensure that integer arithmetic doesnt overflow?

1 Answers  


WHOT IS CHAR?

4 Answers   TCS,


Here is a good puzzle: how do you write a program which produces its own source code as output?

1 Answers  


why TCS selected more student in the software field from all institution.

5 Answers   TCS,


Categories