100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COP 3363 EXAM 2 QUESTIONS WITH LATEST UPDATE $12.49   Add to cart

Exam (elaborations)

COP 3363 EXAM 2 QUESTIONS WITH LATEST UPDATE

 0 view  0 purchase
  • Course
  • COP
  • Institution
  • COP

COP 3363 EXAM 2 QUESTIONS WITH LATEST UPDATE

Preview 2 out of 9  pages

  • November 15, 2024
  • 9
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • COP
  • COP
avatar-seller
lectknancy
COP 3363 EXAM 2 QUESTIONS WITH
LATEST UPDATE
cctype library - Answer-A useful C library of character handling functions

Ex: toupper(), tolower()

Understand the boolean functions whose names start with is, for determining if a
character fits in a certain given category

Array Properties - Answer-indexed collection of data elements of same type

consecutive storage locations

default indexing is 0 through size-1 (where size is the number of elements in the array)

Declaring Arrays - Answer-format: typeName variableName[size];
Ex: int list[10]

The type can be any basic type or any user-defined type

the size must be known by the compiler, so it must be a positive integer literal or
constant.

2-dimensional arrays - Answer-Ex: double table[5][10]

Initializing Arrays - Answer-Can initialize arrays in the same line as declaration

Format: type name[size] = { list of elements };
Ex: int list[5] = {1, 3, 5, 9, 10};

The list of elements goes in { } and is separated by commas

may leave size box empty when initializing on the declaration line - compiler sets size.

Can also initialize with for loops (good with regular patterns)

Initializing Arrays (Special case) - Answer-strings: null-terminated character arrays

can initialize on the declaration with a string literal
Ex: char name[7] = "Marvin";

size must leave room for null-character '\0'

, Using Arrays - Answer-valid indices are 0 through size-1.

may use any of these index numbers to access a single array element:

may use any positive integer r-value to index arrays (i.e. variables, expressions, etc)

it is the programmer's job to check for out-of-bounds index!

Copying Arrays - Answer-Assignment between array names does not copy one array to
another

If you want to copy one array to another, do it element by element (easy with a loop)

Using c-strings - Answer-A c-string can be used like a normal array (of characters)

cout and cin objects also work with c-strings (for output and input of words)

>> operator for input stops at white space (space, tab, newline, etc.)
only good for one word at a time

get and getline for reading strings from input
get, getline read up to specified delimiter -- can read entire sentences

Arrays as function parameters - Answer-Know how to pass an array into a function

Usually a good idea to pass in a size as well

Function always has access to the array contents -- only the address is sent in
-There's no pass-by-value vs. pass-by-reference with arrays

Use const on the array parameter when the function shouldn't change the array

Array Usage and Algorithms - Answer-Understand how to handle arrays that are
declared to a certain size, but are not always "full" to their capacity

Understand common array algorithms and patterns, including (but not limited to):
-iterating through an array elements with a loop
-Printing array contents
-adding or counting array elements
-finding largest/smallest element of an array
-initializing array contents, with either formulas, user entry, or initializer list
-Using parallel arrays
-Swapping or moving around array elements

<cstring> library functions: - Answer-strlen
strcpy

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller lectknancy. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $12.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

75323 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$12.49
  • (0)
  Add to cart