100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
College aantekeningen

Arrays in Data Structure | Declaration, Initialization, Memory representation

Beoordeling
-
Verkocht
-
Pagina's
2
Geüpload op
28-02-2023
Geschreven in
2020/2021

Get information related to Arrays in Data Structure its Declaration, Initialization, Memory representation

Instelling
Vak








Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Vak

Documentinformatie

Geüpload op
28 februari 2023
Aantal pagina's
2
Geschreven in
2020/2021
Type
College aantekeningen
Docent(en)
Prof. jenny
Bevat
Alle colleges

Onderwerpen

Voorbeeld van de inhoud

1.1 Arrays in Data Structure | Declaration, Initialization,
Memory representation

It is to 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
$7.99
Krijg toegang tot het volledige document:

100% tevredenheidsgarantie
Direct beschikbaar na je betaling
Lees online óf als PDF
Geen vaste maandelijkse kosten

Maak kennis met de verkoper
Seller avatar
atharvashetye

Maak kennis met de verkoper

Seller avatar
atharvashetye Exam Questions
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
0
Lid sinds
2 jaar
Aantal volgers
0
Documenten
3
Laatst verkocht
-
Informative Notes

Notes which are informative and helpful to you. Solve your doubts with ease.

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen