C Programming Variable Declaration

Hey my name is Junaid shahid. Today I will tell you about the c programming variable declaration. The word declaration is mean to declare anything or state anything. So that declare or state any variable openly in the start of code is called variable declaration. Declaration is another aspect of the programming. You can declare variables, functions and classes. Each has its own concept and usage in the programming languages.

Introduction

There are two kind of declarations are used in programming languages. The one is external declaration of variables and other is the internal declaration. The external declaration means to declare the variables out of the main class of the program or the main function of the program. The internal declaration means to declare the variables inside the main program class or the main function. To understand the basic concept and logic of the declaring any variable, I have sample codes.

The above code is the example of the declaring any variable or the variable declaration. It can be externally or internally declared in the program based on the requirements of the solutions. Now I going to share the code of externally declared variables and after that internally declared variables.

External declared variables

Internal declared variables

Now you can view the difference of these two variable declarations. The aspect of external declared variable is that, they are globally accessible throughout the program, without any limitation and restriction. But the internally declared variables have their own life and scope of use. They are only global inside the main function. Outside of the main function internally declared variable are not accessible.

Conclusion

I have tried to explain you about the aspect of c programming variable declaration. I hope I have cleared your concept about the declaration, externally or internally. If you any queries you can freely asked me in comments. You can also join my Facebook group to engage with other programmers. C programming variables are the most common variables which are also used in other programming languages. so pay more attention to understand them if you want to learn other programming languages also.

SEMrush

LEAVE A REPLY

CommentLuv badge