Skip to content

Instantly share code, notes, and snippets.

@henrybear327
Created April 30, 2017 17:09
Show Gist options
  • Save henrybear327/6c7823161c60c0e220ca1fbddd1b7c72 to your computer and use it in GitHub Desktop.
Save henrybear327/6c7823161c60c0e220ca1fbddd1b7c72 to your computer and use it in GitHub Desktop.
indirectCharPtr.cpp
#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