Created
April 30, 2017 17:09
-
-
Save henrybear327/6c7823161c60c0e220ca1fbddd1b7c72 to your computer and use it in GitHub Desktop.
indirectCharPtr.cpp
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 <bits/stdc++.h> | |
using namespace std; | |
int main() | |
{ | |
char hello[100][16]; | |
strcpy(hello[0], "hello"); | |
strcpy(hello[1], "world"); | |
printf("%s\n%s\n", hello[0], hello[1]); | |
printf("%d\n", (int)strlen(hello[0])); | |
printf("%p %p\n", hello[0], hello[1]); | |
printf("%p %c\n", *(hello + 1) + 2, *(*(hello + 1) + 2)); | |
printf("%p %c\n", (*hello) + 16 + 2, *((*hello) + 16 + 2)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment