|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Problems
Problem 2.1:
Is the following piece of C code valid?
int main()
{
int *steve;
steve = &steve;
return 0;
}
[Solution]Problem 2.2:
What is wrong with the following code?
int main()
{
int *steve;
*steve = 100;
printf("%d\n", *steve);
return 0;
}
[Solution]Problem 2.3:
Will the following code compile and run?
int main()
{
int a = 5;
a = *&*&*&*&a;
printf("a is %d\n", a);
return 0;
}
[Solution]Problem 2.4:
Will the following code compile and run?
int main()
{
int a = 5;
a = **&&a;
printf("a is %d\n", a);
return 0;
}
[Solution]Problem 2.5:
Why do we care about assigning the value NULL
to a pointer when the pointer isn't being used?
[Solution]
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contact Us | Privacy Policy | Terms and Conditions | About
©2006 SparkNotes LLC, All Rights Reserved.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||