0
global variables?
I have a program which I need it to constantly read a variable that can be used in all user defined functions. I understand that all variables are voided but is there a method to declare a global variable?
2 Réponses
0
Declare the variables you want to make it public before main function.... Using public
Example
#include <iostream>
Using namespace std;
public int age=5;
public string name = "myName" ;
main()
0
Try to avoid them as they are considered to be bad practice. Might lead to slow start and close time of application.