“diiflerent entre * et” Réponses codées

diiflerent entre * et

int a; // Declares a variable
int *b; // Declares a pointer
int &c; // Not possible

a = 10;
b = &a; // b gets the address of a
*b = 20; // a now has the value 20
Powerful Pig

void funct(int a) // A declaration of a function, a is declared
void funct(int *a) // a is declared as a pointer
void funct(int &a) // a now receives only pointers (address)

funct(a) // Creates a copy of a
funct(*a) // Uses a pointer, can create a pointer of a pointer in some cases
funct(&a) // Sends an address of a pointer
Powerful Pig

Réponses similaires à “diiflerent entre * et”

Questions similaires à “diiflerent entre * et”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code