Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**** Ponteiros e Vetores em C ****
- & - referência (retorna um ponteiro)
- * - dereferência (retorna um valor)
- ****/
- #include <stdio.h>
- int main() {
- char vec[] = {'a', 'b', 'c', 'd', 'e', '\0'};
- printf("vec[0]: %c \n", vec[0]);
- printf("*vec: %c \n\n", *vec);
- // vec[0] == *vec
- printf("vec[1]: %c \n", vec[1]);
- printf("*(vec+1): %c \n\n", *(vec+1));
- printf("vec[2]: %c \n", vec[2]);
- printf("*(vec+2): %c \n\n", *(vec+2));
- printf("vec: %p \n", vec);
- printf("&(vec[0]): %p \n\n", &(vec[0]));
- printf("vec: %s \n", vec);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement