Total Pageviews

16,230

Tuesday, 15 September 2015

C Programming Arrays and Functions [1.0.16]

In C programming, a single array element or an entire array can be passed to a function. Also, both one-dimensional and multi-dimensional array can be passed to function as argument. Passing One-dimensional Array In Function C program to pass a single element of an array to function #include <stdio.h> void display(int a) { printf("%d",a); } int main(){ int c[]={2,3,4}; display(c[2]); //Passing array element c[2] only. return 0; } Output 4 Single element of an array can be passed in similar manner as passing...

C Programming Multidimensional Arrays [1.0.15]

C programming language allows programmer to create arrays of arrays known as multidimensional arrays. For example: float a[2][6]; Here, a is an array of two dimension, which is an example of multidimensional array. For better understanding of multidimensional arrays, array elements of above example can be thinked of as below: Initialization of Multidimensional Arrays In C, multidimensional arrays can...