✏️ Explanatory Question

What is the difference between variable declaration and variable definition in C?

👁 8,731 Views
📘 Detailed Answer
💡

Answer with Explanation

  • Variable declaration tells the compiler about data type and size of the variable. Whereas, variable definition allocates memory to the variable
  • Variable can be declared many times in a program. But, definition can happen only one time for a variable in a program.
  • Variable declaration is for assignment of properties and identification to a variable. Whereas, variable definition is for assignments of storage space to a variable