• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Start selling Create your account
Document preview thumbnail
Preview 1 out of 1 pages
Summary

Summary SCC 120 Strings Review

Document preview thumbnail
Preview 1 out of 1 pages

This is a comprehensive and detailed summary on; strings for SCC 120. An Essential Study resource just for YOU!!

Content preview

Lecture 12: Strings
All data in is represented in a computer as binary. Characters are encoded into binary using
character sets such as ASCII, Extended ASCII or Unicode.

ASCII
Uses 7 bits to store all English characters (upper and lower case) as well as numbers, punctuation
and some control codes, which are mostly obsolete. Because ASCII uses 7 bits, it can easily be stored
within one byte.

Strings
Strings are an abstract data type that represent words. In reality, they are arrays of the characters
that make up the words. It is possible to compare strings by showing whether they are greater of
lesser than another string based on alphabetical order.

All strings end with a special byte, called the null byte. This signifies the end of a string and so means
that the array of characters assigned to a string will always be one greater in size than it seems it
should be. For example, “Hello World!” has 12 characters, but the character array would have 13
elements in.

Strings in C
In C, the library <string.h> provides functions for dealing with strings. In C, the compiler always
assumes that a string ends with a null byte (‘\0’).

strcpy(dest, txt) – copies the text in ‘txt’ to the variable in the ‘dest’ position.

strcat(txt1, txt2) – concatenates txt2 onto the end of txt1.

strlen(txt) – returns the number of characters in ‘txt’ excluding the null byte.

In C, comparing strings is not done by ‘string1 == string2’, instead the following can be used.

strcmp(txt1, txt2) – returns negative if txt1 is alphabetically smaller than txt2, zero if they are the
same and positive if txt1 is bigger than txt2.

strncmp(txt1, txt2, n) – compares the first ‘n’ characters of txt1 and txt2 in the same manner as
above.

Document information

Study
Unknown
Uploaded on
August 20, 2025
Number of pages
1
Written in
2022/2023
Type
Summary
£12.86

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
anyiamgeorge19
3.4
(5)
Sold
63
Followers
16
Items
2147
Last sold
2 weeks ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions