Skip to content

Instantly share code, notes, and snippets.

@sawaken
sawaken / pointer_const.c
Last active August 29, 2015 14:07
Declaration of pointer variable with qualifier "const" in C.
/* gcc 4.7.2 */
#include <stdlib.h>
void f(int** const a)
{
a = malloc(5 * sizeof(int)); // compile error
a[0] = malloc(sizeof(int));
*a[0] = 100;
}