• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 1 fuera de 2 páginas
Notas de lectura

array cs

Document preview thumbnail
Vista previa 1 fuera de 2 páginas

best notes for comp science topic is array

Vista previa del contenido

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

Información del documento

Estudio
Subido en
27 de febrero de 2023
Número de páginas
2
Escrito en
2022/2023
Tipo
Notas de lectura
Profesor(es)
Com
Contiene
Todas las clases
$8.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Vendido
0
Seguidores
0
Artículos
4
Última venta
-



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes