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

# include<stdio.h> aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2](); }

1 Answers  


Write a C program that defines a 2-dimentional integer array called A [50][50]. Then the elements of this array should randomly be initialized either to 1 or 0. The program should then print out all the elements in the diagonal (i.e. a[0][0], a[1][1],a[2][2], a[3][3], ……..a[49][49]). Finally, print out how many zeros and ones in the diagonal.

2 Answers  


How to read a directory in a C program?

4 Answers  


main() { extern i; printf("%d\n",i); { int i=20; printf("%d\n",i); } }

1 Answers  


Write a C program to add two numbers before the main function is called.

11 Answers   Infotech, TC,






main() { int a=10,*j; void *k; j=k=&a; j++; k++; printf("\n %u %u ",j,k); }

1 Answers  


main() { char not; not=!2; printf("%d",not); }

1 Answers  


main() { float i=1.5; switch(i) { case 1: printf("1"); case 2: printf("2"); default : printf("0"); } }

2 Answers  


What is the output for the program given below typedef enum errorType{warning, error, exception,}error; main() { error g1; g1=1; printf("%d",g1); }

1 Answers  


write a program in c language to get the value of arroy keys pressed and display the message which arrow key is pressed?

1 Answers  


What is data _null_? ,Explain with code when u need to use it in data step programming ?

0 Answers   Abbott,


find simple interest & compund interest

2 Answers  


Categories