Beranda > Computers, Programming > Two Dimensional Array

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
myfunction(myArray);
// 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…;

  1. Belum ada komentar.
  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: