error: expected ':', ',', ';', '}' or '__attribute__' before '=' token
-
After compiling the code given below the following error shows.... main.c:4: error: expected ':', ',', ';', '}' or '__attribute__' before '=' token #include struct struct_keywords { char c_keywords[6][10] = {"int", "char", "static" , /* ERROR SHOWS HERE */ "struct", "union", "return"}; }; typedef struct struct_keywords kewords_t; int main(int argc ,char *argv) { kewords_t *struct_ptr; return 0; } What may be the error ????? With regards
-
After compiling the code given below the following error shows.... main.c:4: error: expected ':', ',', ';', '}' or '__attribute__' before '=' token #include struct struct_keywords { char c_keywords[6][10] = {"int", "char", "static" , /* ERROR SHOWS HERE */ "struct", "union", "return"}; }; typedef struct struct_keywords kewords_t; int main(int argc ,char *argv) { kewords_t *struct_ptr; return 0; } What may be the error ????? With regards
-
After compiling the code given below the following error shows.... main.c:4: error: expected ':', ',', ';', '}' or '__attribute__' before '=' token #include struct struct_keywords { char c_keywords[6][10] = {"int", "char", "static" , /* ERROR SHOWS HERE */ "struct", "union", "return"}; }; typedef struct struct_keywords kewords_t; int main(int argc ,char *argv) { kewords_t *struct_ptr; return 0; } What may be the error ????? With regards
-
int main(int argc ,char *argv)
{kewords_t struct_ptr;
struct_ptr.c_keywords = {"int", "char", "static" , "struct", "union", "return"};
}
myprogarm.c: In function 'main': myprogarm.c:17: error: expected expression before '{' token #include struct struct_keywords { char c_keywords[6][10]; }; typedef struct struct_keywords kewords_t; int main(int argc ,char *argv) { kewords_t *struct_ptr; struct_ptr->c_keywords = {"int", "char", "static" , "struct", "union", "return"}; return 0; } :(( Still showing error ...How to clear :(( myprogarm.c: In function 'main': myprogarm.c:17: error: expected expression before '{' token
-
Your initialisers should be outside of the struct definition thus:
struct struct_keywords
{
char c_keywords[6][10];
} mystruct =
{
"int", "char", "static",
"struct", "union", "return"
};Thanks ...using ur code I cleared my errors in the program Thanking u :mad::mad::mad:
-
int main(int argc ,char *argv)
{kewords_t struct_ptr;
struct_ptr.c_keywords = {"int", "char", "static" , "struct", "union", "return"};
}
-
Thanks ...using ur code I cleared my errors in the program Thanking u :mad::mad::mad: