X
xiao
Keith Thompson said:
Presumably the same as his basis for assuming that the OP doesn't ride a
unicorn.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Ok guys , i decided to write it again like this:
34 #include <stdlib.h>
35 #include <stdio.h>
36 #include <string.h>
37 float **Allocate2DFloat(int rows, int columns)
38
39 int main()
40 {
41 FILE *lat,*lon;
42 int i,j;
43 float **latitude;
44
45 lat =
fopen("MOD021KM.A2005243.0255.005.2008027115345.lat", "r");
46 lon =
fopen("MOD021KM.A2005243.0255.005.2008027115345.lon", "r");
47
48 latitude=Allocate2DFloat(nrows, ncolumns);
49
50
51 for(i=0; i<nrows; i++){
52 for(j=0; j<ncolumns; j++){
53
54 latitude[j] = 0.0;
55
56 }
57 }
58
59
60 for(i=0; i<nrows; i++){
61 fread(latitude,sizeof(float),ncolumns,lat);
62 }
63 close(lat);
64 return(0);
65 }
66 /* Function to create a 2D float array of pointers*/
67
68 float **Allocate2DFloat(int rows, int columns)
69 {
70 float **pntr;
71
72
73 pntr = (float **)malloc(sizeof(float*)*rows);
74 pntr[0] = (float *)malloc(sizeof(float)*rows*columns);
75 for(i=1; i<rows; i++)pntr = pntr[i-1]+columns;
76 return pntr;
77 }
But it saids:
ReadClassFiletest.c: In function `Allocate2DFloat':
ReadClassFiletest.c:40: warning: 'main' is usually a function
ReadClassFiletest.c:40: error: syntax error before '{' token
ReadClassFiletest.c:45: error: syntax error before "lat"
Why is that?