This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Nome: Maria Conceição | |
RA: 1700933 | |
Curso: Engenharia da Computação | |
Polo: Ilha Bela | |
Bimestre: 9 | |
Aproveitamento: 9.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printf ("Valor de num: %d\n", num); | |
printf ("Endereço de num: %p\n", &num); | |
printf ("Valor de ptr: %p\n", ptr); | |
printf ("Endereço de ptr: %p\n", &ptr); | |
/* Saída: | |
Valor de num: 7 | |
Endereço de num: 0x7ffee3733b3c | |
Valor de ptr: 0x7ffee3733b3c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printf ("Valor no endeço apontado por ptr: %d\n", *ptr); | |
/* Saída: | |
Valor da variável apontada por ptr: 7 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// aqui o asterisco significa: | |
// "isso aqui é um ponteiro" | |
int *ptr = # | |
// aqui significa: "pega o valor | |
// que está neste endereço" | |
int x = *ptr; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct | |
{ | |
int chave; | |
// outros membros | |
} Registro; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool adicionar (Lista *lst, Registro reg) { ... } | |
Lista lista; | |
Registro registro; | |
registro.chave = 31; | |
adicionar (lista, registro); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int num = 7; | |
printf ("Endereço de num: %p\n", &num); | |
/* Saída: | |
Endereço de num: 0x7ffee3733b3c | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lista adicionar (Lista lst, Registro reg) { ... } | |
Lista nova = adicionar (lista, registro); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double tempo = 0.0; | |
// declara e inicializa | |
double *ptr = &tempo; | |
// valor | |
printf ("%p\n", ptr); | |
// Saída: 0xff53... | |
// endereço |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void foo ( Lista p ) { | |
// modifica p | |
} | |
int main () { | |
Lista a; | |
// passa "a" como valor | |
foo ( a ); | |
return 0; |