c++ global variable
// a.cpp
int x = 5;
// b.cpp
extern int x; // allows b.cpp to access 'x' from a.cpp
c++ global variable
// a.cpp
int x = 5;
// b.cpp
extern int x; // allows b.cpp to access 'x' from a.cpp
c++ variable globale
#include <iostream>
int global = 3; // Une variable globale
void ChangeGlobal()
{
global = 5; // Référence à la variable globale à l'intérieur d'une fonction
}
int main()
{
std::cout << global << '\n'; // Référence à la variable globale dans une autre fonction
ChangeGlobal();
std::cout << global << '\n';
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us