What Are Pointers?


Problems

Problem : Is the following piece of C code valid?


int main()
{
	int *steve;
	steve = &steve;
	return 0;
}


Problem : What is wrong with the following code?


int main()
{
	int *steve;
	*steve = 100;
	printf("%d\n", *steve);
	return 0;
}


Problem : Will the following code compile and run?


int main()
{
	int a = 5;
	a = *&*&*&*&a;
	printf("a is %d\n", a);
	return 0;
}


Problem : Will the following code compile and run?


int main()
{
	int a = 5;
	a = **&&a;
	printf("a is %d\n", a);
	return 0;
}


Problem : Why do we care about assigning the value NULL to a pointer when the pointer isn't being used?


Take a Study Break

Green YOUR SCHOOL!

Click here to get involved with dosomething.org!

John Krasinski's BIG MIRACLE

Click to watch the trailer and read exclusive star interviews!

Do you like Anna?

Read Dear Albert... from ANNA's perspective!

BATTLESHIP, the movie

Here's why we're super jazzed about it.

Do energy juices actually work?

Our blogger puts 'em to the test!


The Book

Cover image

Read What You Love, Anywhere You Like

Get Our FREE NOOK Reading Apps