ALpMontana
КЯaL´da TaNıMaM КuяaL´da
Program akışı sırasında çok boyutlu Array oluşturmak veya boyutunu değiştirmeye yarayan bir uygulama. Pointerlere guzel bir ornek. MS Visual C++ 6.0 ile derlendi.
#include <malloc.h>
double ** Create2dimArray(int, int);
int main()
{
double **pp;
pp = Create2dimArray(7, 5);
return 0;
}
double ** Create2dimArray(int dim1, int dim2)
{
double **pdouble;
int i;
pdouble = (double **) malloc(dim1*sizeof(double*));
for(i=0; i < dim1; i++) {
pdouble = (double *) malloc(dim2*sizeof(double));
}
return pdouble;
}
#include <malloc.h>
double ** Create2dimArray(int, int);
int main()
{
double **pp;
pp = Create2dimArray(7, 5);
return 0;
}
double ** Create2dimArray(int dim1, int dim2)
{
double **pdouble;
int i;
pdouble = (double **) malloc(dim1*sizeof(double*));
for(i=0; i < dim1; i++) {
pdouble = (double *) malloc(dim2*sizeof(double));
}
return pdouble;
}