by Dinesh Thakur Category: Type And Variables

Declaration of a variable in C hints the compiler about the type and size of the variable in compile time. Similarly, declaration of a function hints about type and size of function parameters. No space is reserved in memory for any variable in case of declaration.

Example: int a;
Here variable 'a' is declared of data type 'int'

Defining a variable means declaring it and also allocating space to hold it.

We can say "Definition = Declaration + Space reservation".
Example: int a = 10;

Here variable "a" is described as an int to the compiler and memory is allocated to hold value 10.

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content