Now, let’s see what happens when we declare any variable like int a=10 in C#. When C# compiler will run, it will allocate a block of memory which will have name of variable i.e. a, its type i.e. int and its value i.e. 10. Now this memory can be of type Stack or Heap i.e. variable gets store in Stack or Heap.