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

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

3 Answers  


main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; } a. Runtime error. b. Runtime error. Access violation. c. Compile error. Illegal syntax d. None of the above

1 Answers   HCL,


write a program to count the number the same (letter/character foreg: 's') in a given sentence.

2 Answers  


There were 10 records stored in “somefile.dat” but the following program printed 11 names. What went wrong? void main() { struct student { char name[30], rollno[6]; }stud; FILE *fp = fopen(“somefile.dat”,”r”); while(!feof(fp)) { fread(&stud, sizeof(stud), 1 , fp); puts(stud.name); } }

1 Answers  


main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); }

2 Answers  






what is the code of the output of print the 10 fibonacci number series

2 Answers  


write the function. if all the character in string B appear in string A, return true, otherwise return false.

11 Answers   Google,


How to swap two variables, without using third variable ?

104 Answers   AB, ADP, BirlaSoft, Cisco, Cygnet Infotech, HCL, Hewitt, Honeywell, HP, IBM, Infosys, Manhattan, Microsoft, Mobius, Percept, Satyam, SofTMware, TCS, Wipro, Yamaha,


Write out a function that prints out all the permutations of a string. For example, abc would give you abc, acb, bac, bca, cab, cba. You can assume that all the characters will be unique.

5 Answers   IITR, Microsoft, Nike,


main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }

2 Answers   IBM,


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

1 Answers   Infosys, Microsoft, NetApp,


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  


Categories