TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Mark Trickett
from: Kurt Kuzba
date: 1998-08-09 22:20:56
subject: Array problems

MT>     float inches[100,10]/*, mm2inch=25.4 */;
   Array notation in C is not done that way.
   It should be like this:
float inches[100][10];
MT>                 fprintf(cvrt_file,"%f9.4",inches[j,i]);
   Your fprintf() float definitions are just a bit off:
fprintf(cvrt_file,"%9.4f", inches[j][i]);
   Lastly, you have many variables which are unnecessary.
   It works like this, though the table is wider than the
   screen. You can see it in DOS EDIT.
/*  **************************************************  */
/*                                                      */
/*  tabulated data program to produce a millimeter      */
/*  to inch conversion table                            */
/*  Mark Trickett                                       */
/*  started 2nd of August 1998                          */
/*                                                      */
/*  **************************************************  */
#include 
#include 
#include 
int main(int argc, char *argv[])
{
   FILE *cvrt_file;
   int i, j;
   if (argc != 2 )
   {
      printf("\nUseage: require an output file name");
      printf("\nand nothing else");
      return (1);
   }
   cvrt_file = fopen(argv[1],"w");
   if(cvrt_file)
      for (j = 0; j < 100; j++)
         for (i = 0; i < 10; i++)
            fprintf(cvrt_file, "%9.4f%s",
               ((float)i + ((float)j * 10.0f) / 25.4f)
               (9 == i) ? "\n" : "");
   fclose(cvrt_file);
   return (0);
}

> ] The Sky is full of Good and Bad that Mortals Never Know.....

---
* Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)
SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728 810
SEEN-BY: 639/252 670/213 218
@PATH: 154/750 222 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.