“aiguille” Réponses codées

aiguille

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

aiguille

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

aiguille

#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

aiguille

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

aiguille

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

Réponses similaires à “aiguille”

Questions similaires à “aiguille”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code