Ans: Friend function is the friend of the class. This function
can access protected and private area of the class. But friend function is not the
member of the class. Friend function declared using friend keyword or the scope
operator (::).
Like any other variables, we can also pass entire array to a function. An array name can be named as an argument for the prototype declaration and in function header. When we call the function no need to subscript or square brackets. When we pass array that pass as a call by reference because the array name is address for that array. /* Program to illustrate passing array to function */ #include<stdio.h> void display(int) ; /* function prototype */ main( ) { int num[5] = {100, 20, 40, 15, 33, i ; clrscr( ) ; printf (“\n The content of array is \n”) ; for (i=0; i<5; i++) display (num[i]) ; /*Pass array element fo fun */ getch{ } ; } void display(int n) { printf (“\t%d”, n ) ; } Output: The content of array is 100 20 40 15 3 /* Program to read 10 numbers from keyboard to store these num into array and then c...
Comments
Post a Comment