Intermédiaire
Qu'affiche le code suivant ?
void f(int& x) {
x = x + 1;
cout << "x=" << x << endl;
}
int main() {
int val(1);
f(val);
cout << "val=" << val << endl;
return 0;
}
Auteur: SamuelStatut : PubliéeQuestion passée 276 fois
Modifier
Questions similairesPlus de questions sur C++
4
Écrire une classe C++ avec un constructeur qui prend deux arguments.3
Quelle affirmation concernant les constructeurs est fausse ?2
Quel type utiliser pour représenter une liste de données dont la longueur peut changer ?1
L'opérateur + a été défini pour les objets Complexe grâce à une surcharge interne.1
Comment distinguer un paramètre d'une méthode d'un attribut de la classe en C++