Error message decoding
Hi all!
When I compile my program, I've got an error message in this sequence
1 2 3 4 5 6
|
inf = fopen("proba.txt","r");
for (i=0; i<adatszam; i++)
{
fscanf(inf,"%d %f", &k[i], &data[i]);
}
fclose(inf);
|
And the error is:
invalid types 'int[int]' for array subscript. I'm using Dev-C++ compiler, can anyone help how can i fix this problem?
(adatszam is a pre defined constant, this section of the program would be reading the data from proba.txt)
Last edited on
Where are the declarations of k and data?
Sorry I've not copied the whole for better readability.
Till this sequence the program contains this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
//degree distribution with visibility transform
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <math.h>
using namespace std;
#define adatszam 6
int fokszam;
int i,;
int a,b,c,ya,yb,yc;
float data[adatszam];
int k[adatszam];
FILE *inf, *outf;
int main() {
inf = fopen("proba.txt","r");
for (i=0; i<adatszam; i++)
{
fscanf(inf,"%d %f", &k[i], &data[i]);
}
fclose(inf);
|
I'm trying to read float datas, to data array, and int to k array.
Last edited on
I think I've solved it, after an hour, thanks for helping! :-D
Last edited on
Topic archived. No new replies allowed.