Skip to content

Instantly share code, notes, and snippets.

@FernandoBasso FernandoBasso/pointers.c
Last active Aug 29, 2015

What would you like to do?
#include <stdio.h>
void say_msg(char msg[]);
int main(void) {
char str[] = "C is a butt-kicking programming language.\n";
printf("%ld\n", sizeof(str)); // 43. WTF?!
printf("%ld\n", sizeof(&str)); // 8 or 4. Why? Isn't str already a pointer variable.
// Why the need for the & operator?
return 0;
void say_msg(char msg[]) {
printf("%ld\n", sizeof(msg)); // 8 or 4. Makes sense.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.