scanning #s from file into matrix

Posted on 2006-03-23
Last Modified: 2010-04-15
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.

#include <stdio.h>

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");

     fscanf(fptr,"%f", &matrix[a][b][c][d][e]);

 return 0;
Question by:cooling9999
    1 Comment
    LVL 45

    Accepted Solution

    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.


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
    This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
    The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
    Video by: Grant
    The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now