Skip to content

Instantly share code, notes, and snippets.

@manvscode
Created September 25, 2012 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manvscode/3784309 to your computer and use it in GitHub Desktop.
Save manvscode/3784309 to your computer and use it in GitHub Desktop.
I had to convince my coworker about this. Pointers are not the same as arrays!
#include <stdio.h>
int main()
{
char myarray[ 256];
const char* mystring = "Hello my peeps.";
size_t array_size = sizeof(myarray);
size_t string_size = sizeof(mystring);
printf( " array size = %ld\n", array_size );
printf( "string size = %ld\n", string_size );
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment