“penunjuk” Kode Jawaban

penunjuk

Variable is used to store value
Pointer is used to store addresss of value
Kumaran KM

penunjuk

As discussed earlier, 'p' is a pointer to 'a'. Since 'a' has a value of 10, so '*p' is 10. 'p' stores the address of a. So the output p = 0xffff377c implies that 0xffff377c is the address of 'a'. '&p' represents the address of 'p' which is 0xffff3778. Now, '*&p' is the value of '&p' and the value of '&p' is the address of 'a'. So, it is 0xffff377c.
Unusual Unicorn

penunjuk

#include <iostream>
// by using increment sign we know whole array
int main()
{
	using namespace std;
	int ar[] = { 1,2,3,4,5,6,7,8,9,10 };
	for (int m : ar)
	{
		cout << m << endl;
	}
	return 0;
}
Unusual Unicorn

penunjuk

#include <iostream>
using namespace std;
int main()
{
	int* p;
	p = new int;
	if (p)
	{
		cout << "success";
	}
	return 0;
}
Info Important

penunjuk

p = 0xffff377c
*p = 10
&p = 0xffff3778
*&p = 0xffff377c
Unusual Unicorn

Jawaban yang mirip dengan “penunjuk”

Pertanyaan yang mirip dengan “penunjuk”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya