Created
September 8, 2015 11:08
-
-
Save k0f1sh/0ad4812bd1d89d8e0597 to your computer and use it in GitHub Desktop.
ポインタに+1した時の挙動
This file contains 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> | |
int main() | |
{ | |
int a = 0; | |
int *ptr = &a; | |
printf("intsize = %d\n", sizeof(int)); | |
printf("base = %p\n", ptr); | |
printf("base + 1(int) = %p\n", ptr + 1); | |
printf("base + 1(char) = %p\n", (char *)ptr + 1); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment