void main()

{

int *mptr, *cptr;

mptr = (int*)malloc(sizeof(int));

printf(“%d”,*mptr);

int *cptr = (int*)calloc(sizeof(int),1);

printf(“%d”,*cptr);

}



void main() { int *mptr, *cptr; mptr = (int*)malloc(sizeof(int)); ..

Answer / susie

Answer :

garbage-value 0

Explanation:

The memory space allocated by malloc is uninitialized,
whereas calloc returns the allocated memory space
initialized to zeros.

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C Code Interview Questions

main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }

1 Answers   TCS,


Write a program that produces these three columns sequence nos. using loop statement Sequence nos. Squared Squared + 5 1 1 6 2 4 9 3 9 14 4 16 21 5 25 30

1 Answers   GoDB,


Write a single line c expression to delete a,b,c from aabbcc

2 Answers   Microsoft,


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates.

19 Answers   Amazon, BITS, Microsoft, Syncfusion, Synergy, Vector,


Write a program that reads a dynamic array of 40 integers and displays only even integers

2 Answers  






Sorting entire link list using selection sort and insertion sort and calculating their time complexity

1 Answers   Infosys, Microsoft, NetApp,


1. const char *a; 2. char* const a; 3. char const *a; -Differentiate the above declarations.

3 Answers  


#include<stdio.h> int main() { int x=2,y; y=++x*x++*++x; printf("%d",y); } Output for this program is 64. can you explain how this output is come??

1 Answers  


main() { static char names[5][20]={"pascal","ada","cobol","fortran","perl"}; int i; char *t; t=names[3]; names[3]=names[4]; names[4]=t; for (i=0;i<=4;i++) printf("%s",names[i]); }

2 Answers  


main() { if ((1||0) && (0||1)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above

5 Answers   HCL,


void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n"); }

3 Answers   Accenture,


How to reverse a String without using C functions ?

33 Answers   Matrix, TCS, Wipro,


Categories