06 August 2010

Array Literals in C

#include <stdio.h>

void take_array(int[]);

int main(void)
{
take_array((int[]){1, 2, 3}); // here's the point, we must do cast here!

return 0;
}

void take_array(int arr[])
{
printf("IN: take_array(int[])\n");
}

No comments: