W jaki sposób zrobićz tej tablicy statycznej tablicę dynamiczną
linijka 52: double *tablica1[4][5]={0};//zamiana na tablicę dynamiczną *tab[M][L] ??
// wskazniki na tablice.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "iostream"
#include <conio.h>
using namespace std;
void (__cdecl funkcja1)(int N,int M,int L,double *tablica2);
int _tmain(int argc, _TCHAR* argv[])
{
double tab[3][4][5]={0};
cout<<"przed funkcja"<<endl;
for(int i=0;i<3;i++)
{
for(int j=0;j<4;j++)
{
for(int k=0;k<5;k++)
{
tab[i][j][k]=i+j+k;
cout<<" "<<tab[i][j][k];
}
cout<<endl;
}
cout<<endl;
}
system("pause");
//cout<<"przed funkcja"<<endl;
////////////////////////
funkcja1(3,4,5,&tab[0][0][0]);
////////////////////////
cout<<"po funkcji"<<endl; for(int i=0;i<3;i++)
{
for(int j=0;j<4;j++)
{
for(int k=0;k<5;k++)
{
cout<<" "<<tab[i][j][k];
}
cout<<endl;
}
cout<<endl;
}
system("pause");
return 0;
}
void (__cdecl funkcja1)(int N,int M,int L,double *tablica2)
{
cout<<"w funkcji"<<endl;
double *tablica1[4][5]={0};//zamiana na tablicę dynamiczną tab[M][L] ??
for(int i=0;i<N;i++)
{
for(int j=0;j<M;j++)
{
tablica1[i][j]=&tablica2[j*L+i*M*L];//budowa tablicy
}
}
for(int i=0;i<N;i++)
{
for(int j=0;j<M;j++)
{
for(int k=0;k<L;k++)
{
cout<<" "<<tablica1[i][j][k];
tablica1[i][j][k]=9;
}
cout<<endl;
}
cout<<endl;
}
system("pause");
}// koniec void (__cdecl funkcja1)(double *tablica3)