What is a static variable?

what is a static variable? it has not been taught before. and also why are we not using normal variable, i am not able to understand that.

Hello @alankrit.agr99,

You must have learned this while studying functions and pointers or OOPS.

Static is a keyword in C++ used to give special characteristics to an element. Static elements are allocated storage only once in a program lifetime in the static storage area. And they have a scope till the program lifetime. Static Keyword can be used with following,

  • Static variable in functions
  • Static Class Objects
  • Static member Variable in class
  • Static Methods in the class

For more detailed information you can refer to the following links:

  1. static variables.
  2. static keyword.

Let me know if you don’t understand something.

Hope, this would help.
Give a like if you are satisfied.

Yes I think the order of the course is not correct. DMA has not been taught yet but it is being use in string tutorials.