Sign up for your FREE 7-day trial.Get instant access to all the benefits of SparkNotes PLUS! Cancel within the first 7 days and you won't be charged. We'll even send you a reminder.
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.
Step 2 of 4
Choose Your Plan
Step 3 of 4
Add Your Payment Details
Step 4 of 4
Payment Summary
Your Free Trial Starts Now!
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!
Thanks for creating a SparkNotes account! Continue to start your free trial.
Please wait while we process your payment
Your PLUS subscription has expired
We’d love to have you back! Renew your subscription to regain access to all of our exclusive, ad-free study tools.
Did you know you can highlight text to take a note?x
A string in C is essentially a block of memory where each subsequent
byte stores the next character in the string. That is, the first
character goes into the first byte the second character into the second
byte. In other words, all of the characters are in contiguous bytes.
The end of the string is then marked with a special character '\0'
called the null character. If you consider what an array looks
like in memory, it is essentially contiguous blocks of the same data-type.
So a string in C is a type of an array, namely a char array which is
null-terminated array. The null character marks the end of the array
to make it easy to know when the string ends (and thereby avoid moving
off the end of an array and possibly causing a memory violation).
Figure %: "SPARK" in Memory
For example, if you declare a string char *str="SPARK"; then you can
index into the string by treating str as an array. So str[0] is the
character 'S'. str[3] is the character 'R'. str[5] is the null
character which marks the end of the string. Many string routines rely
on strings being null terminated and may cause memory violations if this
is not the case.