100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
array cs CA$12.08   Add to cart

Class notes

array cs

 6 views  0 purchase

best notes for comp science topic is array

Preview 1 out of 2  pages

  • February 27, 2023
  • 2
  • 2022/2023
  • Class notes
  • Com
  • All classes
All documents for this subject (1)
avatar-seller
tanvipatel
1.1 Arrays in Data Structure | Declaration, Initialization,
Memory representation

be stored in memory now as you can see theory is stored in 20 bytes memory starting from the
0th byte and ending at the 19th byte. So theory is stored in consecutive bytes in memory. Now If
I want to access any of these elements, I will use the indexing operator, which is the square
bracket []. So I can say here [0] that is the first element of this array. Now if I want to access any
other element. I will use the indexing operator again and this time I will use the plus sign (+). So
I can say here [1] that is the second element of this array and so on until I reach the last element
of this array, which is [19]. So this is how you can access any of these elements of the array
using the indexing operator [] and then using the plus sign (+) see now Another way to initialize
an array at runtime is by using a pointer variable. See now suppose we have a pointer variable
called p that points to an area in memory that contains an array called [UNK] fine now at
runtime. We can say p->elements[0] that is referencing the first element of [UNK] See now
Another way to initialize an array at runtime is by using a const pointer variable. See now
suppose we have a const pointer variable called p that points to an area in memory that
contains an array called [UNK] fine now at runtime. We can say const p->elements[0] that is
referencing the first element of [UNK]. See now Another way to initialize an array at runtime is. a
dynamic pointer variable see now suppose we have a dynamic pointer variable called P that
points to an area in memory that contains an array called [UNK] fine. Now at runtime, we can
say p->elements[0] that is referencing the first element of [UNK], but what if we want to access
more than one element from this array at runtime. What would we do see now suppose we want
to access both [1] and [2] from this array at runtime. We can do this by using the two indexing
operators [] and (+) Like this see now another way to access more than one element from this
array at runtime is by using a compound assignment operator (=). Like this see now suppose we
want to access both [1] and [2] from this array, but we also want to assign them both to another
variable called V right so we. Do like this P = V[1] + V[2] see now one more way to access more
than one element from this array at runtime is THe data for this array is stored in 4 bytes
starting at offset 0. THe base address of this array is 100. THe address of the first element in
this array is 0. THe author suggests that in order to access an array's data, you need to know

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 tanvipatel. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

79316 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
CA$12.08
  • (0)
  Add to cart