Two Dimensional Array

This article demonstrate how to passing parameter of two dimensional array (C++ languange);
Artikel ini menjelaskan bagaimana melakukan passing parameter untuk array 2 dimensi (bahasa C++);

// Author: Yohan Naftali
// Prototype
void myFunction(long double (*myArray)[noRow]);
//Global Variable
const int NoRow = 10;
const int NoCol = 10; //for array 10×10
void main()

// Array Declaration, this is my style for defining array,
// you may coding with different way
long double (*myArray)[NoRow];
myArray = new long double [NoCol][NoRow];
// Call myFunction array
// After function called, hence myArray already filled with 1,
// just continue your code as you need
void myFunction(long double (*myArray)[NoRow])
for (int i = 0; i < NoCol; i++) {
for (int j = 0; j < NoRow; j++ {
myArray[i][j] = 1.;
// Happy programming…;

Yohan Naftali

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.