+ 1
What's the solution for 'Incomplete type not allowed' ? / structure, c language
This is the structure I used: typedef struct Date struc_date; struct Date { int dd; int mm; int yy; } ; struc_date date; Until here declaration and definition all fine but when I use: scanf("%d", &date.dd); printf(" Your date : %d", date.dd); It gives me an error : incomplete type not allowed. What's the problem here? Can someone explain what exactly the problem here? Btw I am using Microsoft visual studio 2017.
6 Réponses
+ 3
ALi Missaoui I don't have vs 2017 with me, but it worked on app in playground for c language as below:
#include <stdio.h>
struct Date
{
int dd;
int mm;
int yy;
} ;
typedef struct Date struc_date;
int main()
{
struc_date date;
scanf("%d", &date.dd);
printf(" Your date : %d", date.dd);
return 0;
}
+ 2
Ketan Lalcheta thanks bro I solve the problem my project was missing one header file 😂 damn I was so tired didn't notice that I didn't include the corresponding header file .h
Kit D. Cat thanks for mentioning including my files 😄
0
Ketan Lalcheta any idea?
0
Mohamed ELomari it's the same, it should be working in either ways but I dunno why it's giving me incomplete type error..
0
Np! thank you for trying to help me.
0
Yeah see! it should be working like that but when I am running the code with vs 2017 it's still giving me incomplete type error :/