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
| 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
| 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
| int num[] = {1, 5, 9 ,0, 4, 3}; | |
| // aqui o índice 2 é usado para identificar | |
| // o terceiro elemento do array | |
| num[2] = -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
| // usando o operador seta | |
| ptr->membro = valor; | |
| // usando a forma tradicional | |
| (*ptr).membro = valor; |
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
| // declaramos uma estrutura "joao" de tipo Aluno | |
| // e acessamos diretamente com o operador ponto | |
| Aluno joao; | |
| joao.nome = "João"; | |
| // declaramos um ponteiro a uma estrutura e | |
| // acessamos indiretamente com o operador seta | |
| Aluno *ptr_joao = &joao; |
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
| // usando operador ponto | |
| maria.ra = 001234567; | |
| // usando operador seta | |
| joao->ra = 007654321; |
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
| // usando typedef | |
| Aluno joao = { ... }; | |
| // sem usar typedef | |
| struct Aluno maria = { ... }; |
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
| // para visualizar | |
| printf ( "Curso: %s\n", maria.curso ); | |
| // para atualizar | |
| maria.polo = "Osasco"; |
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
| Aluno maria = { | |
| "Maria Conceição", | |
| 1700933, | |
| "Computação", | |
| "Ilha Bela", | |
| 9, | |
| 9.3 | |
| }; |