Skip to content

Instantly share code, notes, and snippets.

View ecounysis's full-sized avatar

Eric Christensen ecounysis

View GitHub Profile
@ehamberg
ehamberg / gist:1875967
Created February 21, 2012 11:23
C Pointer Declarations

C/C++ Pointer Declaration Syntax – It makes sense!

I never really liked the way pointers are declared in C/C++:

int *a, *b, *c; // a, b and c are pointers to int

The reason is that I am used to reading variable declarations as MyType myVar1, myVar2, myVar3; and I always read “int*” as the type “integer pointer”�. I therefore wanted the following

int* a, b, c; // a is a pointer to int, b and c are ints