Reputation: 3593
I get the error message : error: a storage class can only be specified for objects and functions struct in my header file..
/*
* stud.h
*
* Created on: 12.11.2013
* Author:
*/
//stud.h: Definition der Datenstruktur Stud
#ifndef _STUD_H
#define _STUD_H
struct Stud{
long matrnr;
char vorname[30];
char name[30];
char datum[30];
float note;
};
extern Stud mystud[];
int einlesen (struct Stud[]);
void bubbleSort(struct Stud[] , int );
void ausgeben(struct Stud[], int);
#endif
where is the problem?
Upvotes: 5
Views: 23796
Reputation: 2185
I would say that your problem is with the
extern Stud mystud[];
It probably should change to something more like
extern struct Stud* mystud;
and then in the implementation file for this header:
struct Stud stud_storage[SIZE];
struct Stud* mystud = stud_storage;
I think you could possibly get away with the extern struct Stud mystud[];
declaration with some compilers that will always convert that internally the corresponding pointer type, but not with all compilers (Need to double check my ANSI standard (C89) to be sure, but the conversion is only allowed by the standard in function declarations and definitions not in variable declarations.)
Upvotes: 3