Suggestions
Use up and down arrows to review and enter to select.Please wait while we process your payment
If you don't see it, please check your spam folder. Sometimes it can end up there.
If you don't see it, please check your spam folder. Sometimes it can end up there.
Please wait while we process your payment
By signing up you agree to our terms and privacy policy.
Don’t have an account? Subscribe now
Create Your Account
Sign up for your FREE 7-day trial
Already have an account? Log in
Your Email
Choose Your Plan
Individual
Group Discount
Save over 50% with a SparkNotes PLUS Annual Plan!
Purchasing SparkNotes PLUS for a group?
Get Annual Plans at a discount when you buy 2 or more!
Price
$24.99 $18.74 /subscription + tax
Subtotal $37.48 + tax
Save 25% on 2-49 accounts
Save 30% on 50-99 accounts
Want 100 or more? Contact us for a customized plan.
Your Plan
Payment Details
Payment Summary
SparkNotes Plus
You'll be billed after your free trial ends.
7-Day Free Trial
Not Applicable
Renews December 7, 2023 November 30, 2023
Discounts (applied to next billing)
DUE NOW
US $0.00
SNPLUSROCKS20 | 20% Discount
This is not a valid promo code.
Discount Code (one code per order)
SparkNotes PLUS Annual Plan - Group Discount
Qty: 00
SparkNotes Plus subscription is $4.99/month or $24.99/year as selected above. The free trial period is the first 7 days of your subscription. TO CANCEL YOUR SUBSCRIPTION AND AVOID BEING CHARGED, YOU MUST CANCEL BEFORE THE END OF THE FREE TRIAL PERIOD. You may cancel your subscription on your Subscription and Billing page or contact Customer Support at custserv@bn.com. Your subscription will continue automatically once the free trial period is over. Free trial is available to new customers only.
Choose Your Plan
For the next 7 days, you'll have access to awesome PLUS stuff like AP English test prep, No Fear Shakespeare translations and audio, a note-taking tool, personalized dashboard, & much more!
You’ve successfully purchased a group discount. Your group members can use the joining link below to redeem their group membership. You'll also receive an email with the link.
Members will be prompted to log in or create an account to redeem their group membership.
Thanks for creating a SparkNotes account! Continue to start your free trial.
Please wait while we process your payment
Your PLUS subscription has expired
Please wait while we process your payment
Please wait while we process your payment
Sometimes we know we want a pointer, but we don't necessarily know or care what it points to. The C/C++ language provides a special pointer, the void pointer, that allows us to create a pointer that is not type specific, meaning that it can be forced to point to anything.
Why is this useful? One common application of void pointers is creating functions which take any kind of pointer as an argument and perform some operation on the data which doesn't depend on the data contained. A function to "zero-out" memory (meaning to turn off all of the bits in the memory, setting each byte to the value 0) is a perfect example of this.
You're probably wondering what that (char *) thing is in the memzero() function above. Well, it's what's called a cast. Casting is a way for a programmer to tell the computer that, even though the computer thinks something is one type, we want to treat it as another type.
You've probably already seen casting before, though not necessarily in the context of pointers. For example:
The syntax used in the memzero() function above is referred to as an explicit cast, meaning that the programmer tells the computer exactly how the data should be treated. To convey to the computer that I wanted the pointer to be a treated as a character pointer, we put the type inside parentheses, as in (char *), and place it immediately before the item we want to cast, in this case, ptr. Once we perform this cast we can dereference the variable and set the memory's value to 0.
Why did I have to cast it? Why couldn't I have just done *ptr = 0? Because that statement doesn't make any sense to the computer. As far as the computer is concerned, ptr is just an address in memory; it has no type information associated with it. How does the computer know how many bytes this pointer points to? It doesn't. So telling the computer to set *ptr to 0 doesn't make any sense to it; in fact, a compiler shouldn't even be able to compile this since it's ambiguous. As such, we need to tell the computer exactly how we want to treat ptr. In this case, as we want to zero out each byte, we want to cast it to a data type that is exactly one byte long. A character is one byte long, so we cast the void *ptr to be a char *.
Please wait while we process your payment