I declared variable int count as "static" in declarations.h file, Now on creating each Node in a LinkList I am incrementing the value of count in the creatNode() and the incremented count is also displayed inside the creatNode() whenever user wants to add a Node. BUT, when I want to display the total count value in display(), it is showing as Count : 0.
static means a variable will be globally known only in this file. extern means a global variable defined in another file will also be known in this file, and is also used for accessing functions defined in other files. A local variable defined in a function can also be declared as static . So, instead of making count as static in declarations file make it as extern.