Multidimensional arrays & Functions
Lecture 5 - Multidimensional arrays & Functions
Functions
we can pass to a functions either by:
reference
value
Here we pass by value
public class Main {
public static void printMe(int value_of_num) {
System.out.println(value_of_num);
value_of_num = 99;
}
public static void main(String[] args) {
int num = 5;
printMe(num);
printMe(num);
}
}The function is void since it doesn't return a value
also here we pass by value
The function is int since we return a value
Exercise: Palindrome

Multidimensional arrays



Each array can be a different size
Exercise: print the matrix and its sum
Explanation:
here
arr is passed by
reference
and not by value
Exercise: Trace of matrix

Exercise: Transpose

Exercise: Check Symmetry of matrix


Matrix Multiplication

Last updated
Was this helpful?