“Diiferent antara * dan” Kode Jawaban

Diiferent antara * dan

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

Jawaban yang mirip dengan “Diiferent antara * dan”

Pertanyaan yang mirip dengan “Diiferent antara * dan”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya