• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

scanning #s from file into matrix

ok, here's my code. i'm getting syntax errors on each level of the loop befor '=' and ')'. if anyone sees anything else wrong, let me know.
thanx!!

#include <stdio.h>

///////////////////////
//READ FUNCTION//
int read(){

#define SIZE = 5
float matrix[5][5][5][5][5];
int a, b, c, d, e;
FILE *fptr;
char name[10];

printf("Please enter a file name--");
fgets(name, sizeof(name), stdin);
fptr = fopen(name, "r");

for(a=0;a<SIZE;a++){
 for(b=0;b<SIZE;b++){
  for(c=0;c<SIZE;c++){
   for(d=0;d<SIZE;d++){
    for(e=0;e<SIZE;e++){
     fscanf(fptr,"%f", &matrix[a][b][c][d][e]);
}}}}}

 return 0;
}
0
cooling9999
Asked:
cooling9999
1 Solution
 
sunnycoderCommented:
Hi cooling9999,

1. there is no main() function

2. #define SIZE = 5 is incorrect ... Should have been #define SIZE 5. #defines replace string literally.

3. x is undefined should have been matrix instead.

Cheers!
Sunnycoder
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now