Question Detail

Difference between calloc() and malloc()

  • calloc() takes a single argument while malloc() needs two arguments
  • malloc() takes a single argument while calloc() needs two arguments
  • malloc() initializes the allocated memory to ZERO
  • calloc() initializes the allocated memory to NULL
Similar Questions :

1. The first expression in a for loop is

  • Step value of loop
  • Value of the counter variable
  • Any of above
  • None of above

2. What is the purpose of getc()

  • read a character from STDIN
  • read a character from a file
  • read all file
  • read file random

3. Can getch() be used to echo the input

  • Yes
  • No

4. What is correct order of precedence in C

  • Addition, Division, Modulus
  • Addition, Modulus, Division
  • Multiplication, Substration, Modulus
  • Modulus, Multiplication, Substration

5. What will be the output of following program
#include
main()
{
int x,y = 10;
x = y * NULL;
printf(\"%d\",x);
}

  • error
  • 0
  • 10
  • Garbage value
Read more from - C Programming Questions Answers - Chapter 1