Thread: [Dev-C++] Pointers vs 2-D Arrays: feedback
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <and...@su...> - 2007-09-24 17:41:38
|
Thank you guys!
Now I can make refferences for elements in
a N-D array dynamically allocated.
Translating your help for the old school style,
the final code became:
///////////////////////////////////////////////////////////////////////
/* using a 2-row 3-column array */
#include <stdio.h>
#include <stdlib.h>
int main()
{
double **matriz;
int i, j, k;
matriz = (double **) malloc(2*sizeof(double));
for(j=0; j<3; j++) matriz[j] = (double *) malloc(3*sizeof(double));
k=0;
for(i=0; i<2; i++)
for(j=0; j<3; j++)
matriz[i][j] = ++k;
for(i=0; i<2; i++){
for(j=0; j<3; j++)
printf(" %lf ", matriz[i][j]);
printf("\n");
}
free(matriz);
system("PAUSE");
return 0;
}
//////////////////////////////////////////////////////////////////////
Best Regards
Andre
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.13.30/1027 - Release Date: 24/9/2007
11:27
|
|
From: <and...@su...> - 2007-10-13 12:25:12
|
Dear users,
Please consider the following project-file
cenario:
///file1.c///////
#include "global.h"
main()
{
func_x();
a = 100;
...
}
///file2.c///////
extern int a;
func_x()
{
...
a=300;
}
///global.h///////
int a;
void func_x(void);
///////////
My problem is:
1) I have a lot of file2.c-type files (files with only
function definitions), a lot of functions
and several "extern" variable declarations;
2) Trying to include global.h in file2.c too, avoids
the need of declaring all extern variables. But this
action generates warnings of duplicate includes (2 or
more include global.h);
My question is:
Is there any way to manipulate several file2.c-type files
without declaring each extern variable?
Regards
Andre Barros
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.14.9/1068 - Release Date: 13/10/2007
10:15
|
|
From: Per W. <pw...@ia...> - 2007-10-13 12:33:17
|
//global.h
#ifndef _GLOBAL_H
#define _GLOBAL_H
#ifdef MAIN
#define EXTERN
#else
#define EXTERN extern
#endif
EXTERN int a;
EXTERN int b;
=2E..
#endif // _GLOBAL_H
// main.c
#define MAIN=09=09// Want all global variables in this file.
#include "global.h"
int main(void) {
...
}
// other.c
#include "global.h"=09// Get info about all global variables
/pwm
On Sat, 13 Oct 2007, Andr=E9 Mac=E1rio Barros wrote:
> Dear users,
>
> Please consider the following project-file
> cenario:
> ///file1.c///////
> #include "global.h"
> main()
> {
> func_x();
> a =3D 100;
> ...
> }
> ///file2.c///////
> extern int a;
> func_x()
> {
> ...
> a=3D300;
> }
> ///global.h///////
> int a;
> void func_x(void);
> ///////////
>
> My problem is:
> 1) I have a lot of file2.c-type files (files with only
> function definitions), a lot of functions
> and several "extern" variable declarations;
> 2) Trying to include global.h in file2.c too, avoids
> the need of declaring all extern variables. But this
> action generates warnings of duplicate includes (2 or
> more include global.h);
> My question is:
> Is there any way to manipulate several file2.c-type files
> without declaring each extern variable?
>
> Regards
> Andre Barros
>
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.14.9/1068 - Release Date: 13/10/20=
07
> 10:15
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: <and...@su...> - 2007-10-14 17:35:53
|
Thank you!
But, I forgot to tell that:
The "other.c"-type files also make
references to the global variables and
they also call functions that belong to
other "other.c"-type files.
In other words:
///main.c///////
#include "global.h"
main()
{
func_1();
a = 100;
func_2();
func_3()
...
}
///module1.c///////
extern int a;
extern int b;
extern int c;
func_1()
{
a=300;
...
}
///module2.c///////
extern int a;
extern int b;
extern int c;
extern func_1();
func_2()
{
a=300;
func_1(); // see this!
...
}
///module3.c///////
extern int a;
extern int b;
extern int c;
extern func_1();
func_3()
{
a=300;
func_1(); // see this!
...
}
///global.h///////
int a;
int b;
int c;
void func_1(void);
void func_2(void);
void func_3(void);
/////////////
Yes, I could improve the flexiblity of these functions
using parameter-passing. But, is there anything that I
can do to avoid these "extern" declarations in the modules?
Regards
Andre
-----Mensagem original-----
De: Per Westermark [mailto:pw...@ia...]
Enviada em: sábado, 13 de outubro de 2007 09:33
Para: André Macário Barros
Cc: dev...@li...
Assunto: Re: [Dev-C++] Programming with multiple modules/files
//global.h
#ifndef _GLOBAL_H
#define _GLOBAL_H
#ifdef MAIN
#define EXTERN
#else
#define EXTERN extern
#endif
EXTERN int a;
EXTERN int b;
...
#endif // _GLOBAL_H
// main.c
#define MAIN // Want all global variables in this file.
#include "global.h"
int main(void) {
...
}
// other.c
#include "global.h" // Get info about all global variables
/pwm
On Sat, 13 Oct 2007, André Macário Barros wrote:
> Dear users,
>
> Please consider the following project-file
> cenario:
> ///file1.c///////
> #include "global.h"
> main()
> {
> func_x();
> a = 100;
> ...
> }
> ///file2.c///////
> extern int a;
> func_x()
> {
> ...
> a=300;
> }
> ///global.h///////
> int a;
> void func_x(void);
> ///////////
>
> My problem is:
> 1) I have a lot of file2.c-type files (files with only
> function definitions), a lot of functions
> and several "extern" variable declarations;
> 2) Trying to include global.h in file2.c too, avoids
> the need of declaring all extern variables. But this
> action generates warnings of duplicate includes (2 or
> more include global.h);
> My question is:
> Is there any way to manipulate several file2.c-type files
> without declaring each extern variable?
>
> Regards
> Andre Barros
>
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.14.9/1068 - Release Date:
13/10/2007
> 10:15
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.14.9/1068 - Release Date: 13/10/2007
10:15
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.14.10/1070 - Release Date: 14/10/2007
09:22
|
|
From: Per W. <pw...@ia...> - 2007-10-14 20:50:48
|
First of all - if I was you, I would immediately rewrite the functions to
take parameters. Globals for parameter-passing is WRONG. W.R.O.N.G. You
most definitely don't want such a solution. For a school work, you would
not pass. For a commercial work, you would get huge support costs. For
private stuff - no reason why not do it the correct way!
Second: My suggesttion does handle multiple files including the same
global.h file, and takes care of the extern keyword in a reasonable way.
Having multiple source files calling functions from multiple other source
files is how most software is written. Either write one header file for
each source file, and let each source file include all needed include
files. Or, if the project is small, add all function prototypes to a
single include file.
But make sure that you immediately drop any globals for parameter passing.
Yow will you ever remember to give all global variables an initial value
before calling a function? With parameters, the compiler will complain.
With globals, it will not know!
/pwm
On Sun, 14 Oct 2007, Andr=E9 Mac=E1rio Barros wrote:
> Thank you!
>
> But, I forgot to tell that:
> The "other.c"-type files also make
> references to the global variables and
> they also call functions that belong to
> other "other.c"-type files.
>
> In other words:
> ///main.c///////
> #include "global.h"
> main()
> {
> func_1();
> a =3D 100;
> func_2();
> func_3()
> ...
> }
> ///module1.c///////
> extern int a;
> extern int b;
> extern int c;
> func_1()
> {
> a=3D300;
> ...
> }
> ///module2.c///////
> extern int a;
> extern int b;
> extern int c;
> extern func_1();
> func_2()
> {
> a=3D300;
> func_1(); // see this!
> ...
> }
> ///module3.c///////
> extern int a;
> extern int b;
> extern int c;
> extern func_1();
> func_3()
> {
> a=3D300;
> func_1(); // see this!
> ...
> }
> ///global.h///////
> int a;
> int b;
> int c;
> void func_1(void);
> void func_2(void);
> void func_3(void);
> /////////////
>
> Yes, I could improve the flexiblity of these functions
> using parameter-passing. But, is there anything that I
> can do to avoid these "extern" declarations in the modules?
>
> Regards
> Andre
>
>
> -----Mensagem original-----
> De: Per Westermark [mailto:pw...@ia...]
> Enviada em: s=E1bado, 13 de outubro de 2007 09:33
> Para: Andr=E9 Mac=E1rio Barros
> Cc: dev...@li...
> Assunto: Re: [Dev-C++] Programming with multiple modules/files
>
>
> //global.h
> #ifndef _GLOBAL_H
> #define _GLOBAL_H
>
> #ifdef MAIN
> #define EXTERN
> #else
> #define EXTERN extern
> #endif
>
> EXTERN int a;
> EXTERN int b;
> ...
>
> #endif // _GLOBAL_H
>
> // main.c
> #define MAIN=09=09// Want all global variables in this file.
> #include "global.h"
>
> int main(void) {
> ...
> }
>
> // other.c
> #include "global.h"=09// Get info about all global variables
>
> /pwm
>
> On Sat, 13 Oct 2007, Andr=E9 Mac=E1rio Barros wrote:
>
> > Dear users,
> >
> > Please consider the following project-file
> > cenario:
> > ///file1.c///////
> > #include "global.h"
> > main()
> > {
> > func_x();
> > a =3D 100;
> > ...
> > }
> > ///file2.c///////
> > extern int a;
> > func_x()
> > {
> > ...
> > a=3D300;
> > }
> > ///global.h///////
> > int a;
> > void func_x(void);
> > ///////////
> >
> > My problem is:
> > 1) I have a lot of file2.c-type files (files with only
> > function definitions), a lot of functions
> > and several "extern" variable declarations;
> > 2) Trying to include global.h in file2.c too, avoids
> > the need of declaring all extern variables. But this
> > action generates warnings of duplicate includes (2 or
> > more include global.h);
> > My question is:
> > Is there any way to manipulate several file2.c-type files
> > without declaring each extern variable?
> >
> > Regards
> > Andre Barros
> >
> >
> >
> > No virus found in this outgoing message.
> > Checked by AVG Free Edition.
> > Version: 7.5.488 / Virus Database: 269.14.9/1068 - Release Date:
> 13/10/2007
> > 10:15
> >
> >
> > -----------------------------------------------------------------------=
--
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems? Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.14.9/1068 - Release Date: 13/10/20=
07
> 10:15
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.14.10/1070 - Release Date: 14/10/2=
007
> 09:22
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: <and...@su...> - 2007-11-11 05:28:12
|
Dear Users,
Could you confirm if this function is
correct?
The reason of my question is: inspecting
the address of *vect in line x in the function
is different of line y. I was expecting equal
addresses, wasn´t?
////////// code /////////////////////////
int Alocate2DVect(int ***vect, int lin, int col)
{
int i, *pont;
*vect = (int **) malloc(lin*sizeof(int)); // line x
if(!vect) return(0);
for(i=0; i<col; i++) *(*vect + i) = (int *) malloc(col*sizeof(int));
if(!vect) return(0); // line y
return(1);
}
int main()
{
int **vector2D;
int i, j, lin=3, col=4;
if(!Alocate2DVect(&vector2D, lin, col)) exit(1);
for(i=0; i<lin; i++)
for(j=0; j<col; j++)
vector2D[i][j] = i + j;
for(i=0; i<lin; i++){
for(j=0; j<col; j++){
printf("%d\t", vector2D[i][j]);
}
printf("\n");
}
free(vector2D);
system("PAUSE");
return 0;
}
//////////// end of code /////////
Regards
Andre
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date: 10/11/2007
15:47
|
|
From: Per W. <pw...@ia...> - 2007-11-11 07:26:50
|
First of all - your code would be a bit simpler (you would loose one
indirection) if you modify Allocate2DVect (two l in allocate) to return
the pointer instead of taking it as a parameter.
Second: your test if (!vect) does not check the result of the allocation,
but if you sent a pointer in to the function.
Third: You normally don't need to release memory before ending a program,
but if you do, then your code is incorrect. You need to release all
columns before releasing the row vector.
/pwm
On Sun, 11 Nov 2007, Andr=E9 Mac=E1rio Barros wrote:
> Dear Users,
>
> Could you confirm if this function is
> correct?
> The reason of my question is: inspecting
> the address of *vect in line x in the function
> is different of line y. I was expecting equal
> addresses, wasn=B4t?
>
> ////////// code /////////////////////////
>
> int Alocate2DVect(int ***vect, int lin, int col)
> {
> int i, *pont;
>
> *vect =3D (int **) malloc(lin*sizeof(int)); // line x
> if(!vect) return(0);
> for(i=3D0; i<col; i++) *(*vect + i) =3D (int *) malloc(col*sizeof(int)=
);
> if(!vect) return(0); // line y
> return(1);
> }
>
=09> int main()
> {
> int **vector2D;
> int i, j, lin=3D3, col=3D4;
>
> if(!Alocate2DVect(&vector2D, lin, col)) exit(1);
>
> for(i=3D0; i<lin; i++)
> for(j=3D0; j<col; j++)
> vector2D[i][j] =3D i + j;
>
> for(i=3D0; i<lin; i++){
> for(j=3D0; j<col; j++){
> printf("%d\t", vector2D[i][j]);
> }
> printf("\n");
> }
>
> free(vector2D);
> system("PAUSE");
> return 0;
> }
> //////////// end of code /////////
>
> Regards
> Andre
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date: 10/11/2=
007
> 15:47
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: <and...@su...> - 2007-11-11 13:51:31
|
My way of understand your recommendations
did result in this:
//////code///////////
#include <stdio.h>
#include <stdlib.h>
int **Alocate2DVect(int lin, int col)
{
int i, **vect;
vect = (int **) malloc(lin*sizeof(int));
if(!vect) return(NULL);
for(i=0; i<col; i++){
vect[i] = (int *) malloc(col*sizeof(int));
if(!vect[i]) return(NULL);
}
return(vect);
}
int main()
{
int **vector2D;
int i, j, lin=3, col=4;
vector2D = Alocate2DVect(lin, col);
if(!vector2D) exit(EXIT_FAILURE);
for(i=0; i<lin; i++)
for(j=0; j<col; j++)
vector2D[i][j] = i + j;
for(i=0; i<lin; i++){
for(j=0; j<col; j++){
printf("%d\t", vector2D[i][j]);
}
printf("\n");
}
for(j=0; j<col; j++)
free(vector2D[col]);
free(vector2D);
system("PAUSE");
return 0;
}
///////// end of code ////////
Is it ok?
Thanks!
André
-----Mensagem original-----
De: Per Westermark [mailto:pw...@ia...]
Enviada em: domingo, 11 de novembro de 2007 04:27
Para: André Macário Barros
Cc: dev...@li...
Assunto: Re: [Dev-C++] function for allocate memory for 2D vectors
First of all - your code would be a bit simpler (you would loose one
indirection) if you modify Allocate2DVect (two l in allocate) to return
the pointer instead of taking it as a parameter.
Second: your test if (!vect) does not check the result of the allocation,
but if you sent a pointer in to the function.
Third: You normally don't need to release memory before ending a program,
but if you do, then your code is incorrect. You need to release all
columns before releasing the row vector.
/pwm
On Sun, 11 Nov 2007, André Macário Barros wrote:
> Dear Users,
>
> Could you confirm if this function is
> correct?
> The reason of my question is: inspecting
> the address of *vect in line x in the function
> is different of line y. I was expecting equal
> addresses, wasn´t?
>
> ////////// code /////////////////////////
>
> int Alocate2DVect(int ***vect, int lin, int col)
> {
> int i, *pont;
>
> *vect = (int **) malloc(lin*sizeof(int)); // line x
> if(!vect) return(0);
> for(i=0; i<col; i++) *(*vect + i) = (int *) malloc(col*sizeof(int));
> if(!vect) return(0); // line y
> return(1);
> }
>
> int main()
> {
> int **vector2D;
> int i, j, lin=3, col=4;
>
> if(!Alocate2DVect(&vector2D, lin, col)) exit(1);
>
> for(i=0; i<lin; i++)
> for(j=0; j<col; j++)
> vector2D[i][j] = i + j;
>
> for(i=0; i<lin; i++){
> for(j=0; j<col; j++){
> printf("%d\t", vector2D[i][j]);
> }
> printf("\n");
> }
>
> free(vector2D);
> system("PAUSE");
> return 0;
> }
> //////////// end of code /////////
>
> Regards
> Andre
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date:
10/11/2007
> 15:47
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date: 10/11/2007
15:47
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date: 10/11/2007
15:47
|
|
From: Per W. <pw...@ia...> - 2007-11-11 14:18:40
|
As you can see, the code become simler when you return the allocated array. Two things: If you fail to allocate a column, it might be a good idea to clean up any partial allocations before returning NULL. This is important if you intend to continue to run the program after a failed allocation. A 10k x 10x array of 32-bit integers would consume about 400MB, so an allocation failure could potentially leak 400MB memory. Then rename Alocate2DVect to Allocate2DVect and everything should be ok :) /pwm EMA System email: pw...@ia... Per Westermark web: http://iapetus.neab.net Vargvaegen 174B phone: +46 70 214 74 48 S-906 42 Umeaa Sweden On Sun, 11 Nov 2007, Andr=E9 Mac=E1rio Barros wrote: > My way of understand your recommendations > did result in this: > > //////code/////////// > #include <stdio.h> > #include <stdlib.h> > > int **Alocate2DVect(int lin, int col) > { > int i, **vect; > > vect =3D (int **) malloc(lin*sizeof(int)); > if(!vect) return(NULL); > for(i=3D0; i<col; i++){ > vect[i] =3D (int *) malloc(col*sizeof(int)); > if(!vect[i]) return(NULL); > } > return(vect); > } > > int main() > { > int **vector2D; > int i, j, lin=3D3, col=3D4; > > vector2D =3D Alocate2DVect(lin, col); > if(!vector2D) exit(EXIT_FAILURE); > > for(i=3D0; i<lin; i++) > for(j=3D0; j<col; j++) > vector2D[i][j] =3D i + j; > > for(i=3D0; i<lin; i++){ > for(j=3D0; j<col; j++){ > printf("%d\t", vector2D[i][j]); > } > printf("\n"); > } > > for(j=3D0; j<col; j++) > free(vector2D[col]); > free(vector2D); > > system("PAUSE"); > return 0; > } > > ///////// end of code //////// > > Is it ok? > > Thanks! > Andr=E9 > > > -----Mensagem original----- > De: Per Westermark [mailto:pw...@ia...] > Enviada em: domingo, 11 de novembro de 2007 04:27 > Para: Andr=E9 Mac=E1rio Barros > Cc: dev...@li... > Assunto: Re: [Dev-C++] function for allocate memory for 2D vectors > > > First of all - your code would be a bit simpler (you would loose one > indirection) if you modify Allocate2DVect (two l in allocate) to return > the pointer instead of taking it as a parameter. > > Second: your test if (!vect) does not check the result of the allocation, > but if you sent a pointer in to the function. > > Third: You normally don't need to release memory before ending a program, > but if you do, then your code is incorrect. You need to release all > columns before releasing the row vector. > > /pwm > > On Sun, 11 Nov 2007, Andr=E9 Mac=E1rio Barros wrote: > > > Dear Users, > > > > Could you confirm if this function is > > correct? > > The reason of my question is: inspecting > > the address of *vect in line x in the function > > is different of line y. I was expecting equal > > addresses, wasn=B4t? > > > > ////////// code ///////////////////////// > > > > int Alocate2DVect(int ***vect, int lin, int col) > > { > > int i, *pont; > > > > *vect =3D (int **) malloc(lin*sizeof(int)); // line x > > if(!vect) return(0); > > for(i=3D0; i<col; i++) *(*vect + i) =3D (int *) malloc(col*sizeof(in= t)); > > if(!vect) return(0); // line y > > return(1); > > } > > > =09> int main() > > { > > int **vector2D; > > int i, j, lin=3D3, col=3D4; > > > > if(!Alocate2DVect(&vector2D, lin, col)) exit(1); > > > > for(i=3D0; i<lin; i++) > > for(j=3D0; j<col; j++) > > vector2D[i][j] =3D i + j; > > > > for(i=3D0; i<lin; i++){ > > for(j=3D0; j<col; j++){ > > printf("%d\t", vector2D[i][j]); > > } > > printf("\n"); > > } > > > > free(vector2D); > > system("PAUSE"); > > return 0; > > } > > //////////// end of code ///////// > > > > Regards > > Andre > > > > > > No virus found in this outgoing message. > > Checked by AVG Free Edition. > > Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date: > 10/11/2007 > > 15:47 > > > > > > -----------------------------------------------------------------------= -- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date: 10/11/2= 007 > 15:47 > > No virus found in this outgoing message. > Checked by AVG Free Edition. > Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date: 10/11/2= 007 > 15:47 > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |