aboutsummaryrefslogtreecommitdiff
path: root/.vim/c-support/codesnippets/print_int_array.c.noindent
diff options
context:
space:
mode:
authorRyan Kavanagh <ryanakca@kubuntu.org>2011-08-14 17:16:55 -0400
committerRyan Kavanagh <ryanakca@kubuntu.org>2011-08-25 07:42:57 -0400
commit1c019761dfaf6be82de9284fa5e2b9dbfbdec27d (patch)
tree7ed6bd2f437d3a334bd7a81f62e6dfa63689272b /.vim/c-support/codesnippets/print_int_array.c.noindent
Initial import
Diffstat (limited to '.vim/c-support/codesnippets/print_int_array.c.noindent')
-rw-r--r--.vim/c-support/codesnippets/print_int_array.c.noindent30
1 files changed, 30 insertions, 0 deletions
diff --git a/.vim/c-support/codesnippets/print_int_array.c.noindent b/.vim/c-support/codesnippets/print_int_array.c.noindent
new file mode 100644
index 0000000..02d53c0
--- /dev/null
+++ b/.vim/c-support/codesnippets/print_int_array.c.noindent
@@ -0,0 +1,30 @@
+
+/*
+ * === FUNCTION ======================================================================
+ * Name: print_int_array
+ * Description: Print an int-array with one dimension.
+ * Use
+ * print_int_array( *matrix, n1*n2, n2, "matrix" );
+ * for
+ * int matrix[n1][n2];
+ * =====================================================================================
+ */
+static void
+print_int_array ( int array[], /* array to print */
+ int n, /* number of elements to print */
+ int nrow, /* number of elements per row */
+ char *arrayname /* array name */
+ )
+{
+ int i;
+ printf ("\n\n array \"%s\", length %d\n", arrayname, n );
+ for ( i=0; i<n; i+=1 )
+ {
+ if( i%nrow == 0 )
+ printf ("\n%6d : ", i );
+ printf (" %6d", array[i] );
+ }
+ printf ("\n\n");
+ return ;
+} /* ---------- end of function print_int_array ---------- */
+