Created
April 1, 2024 13:37
-
-
Save henriquesebastiao/76f6094da2dfb955c7ebb385c1f91e07 to your computer and use it in GitHub Desktop.
Testes com ponteiros em C.
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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <stdbool.h> | |
| void main() { | |
| int numero = 10; | |
| int *ponteiro = № | |
| printf("%d\n", numero); | |
| printf("%d\n", &numero); | |
| printf("%d\n", ponteiro); | |
| printf("%d\n", &ponteiro); | |
| printf("%d\n", *ponteiro); | |
| // Output | |
| // 10 (valor da variavel numero) | |
| // -1692088420 (endereço de memória onde está a veriável número) | |
| // -1692088420 (o valor do ponterio é endereço de memória onde está o valor da variável cujo a qual ele referencia) | |
| // -1692088416 (endereço de memória do próprio ponteiro) | |
| // 10 (valor da variavel que o ponteiro está referenciando) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment