From 1c019761dfaf6be82de9284fa5e2b9dbfbdec27d Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Sun, 14 Aug 2011 17:16:55 -0400 Subject: Initial import --- .vim/c-support/codesnippets/calloc_int_matrix.c | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .vim/c-support/codesnippets/calloc_int_matrix.c (limited to '.vim/c-support/codesnippets/calloc_int_matrix.c') diff --git a/.vim/c-support/codesnippets/calloc_int_matrix.c b/.vim/c-support/codesnippets/calloc_int_matrix.c new file mode 100644 index 0000000..e21215b --- /dev/null +++ b/.vim/c-support/codesnippets/calloc_int_matrix.c @@ -0,0 +1,35 @@ + +/* + * === FUNCTION ====================================================================== + * Name: calloc_int_matrix + * Description: Allocate a dynamic int-matrix of size rows*columns; return a pointer. + * ===================================================================================== + */ +int** +calloc_int_matrix ( int rows, int columns ) +{ + int i; + int **m; + m = calloc ( rows, sizeof(int*) ); /* allocate pointer array */ + assert( m != NULL ); /* abort if allocation failed */ + *m = calloc ( rows*columns, sizeof(int) ); /* allocate data array */ + assert(*m != NULL ); /* abort if allocation failed */ + for ( i=1; i