You are watching: Error: two or more data types in declaration specifiers
Registered User Join day Nov 2010Location long Beach, CAPosts 5,909
Always compile through the warning level collection to max (e.g. -Wall flag because that gcc, else review your compiler documentation). You need to see other like:
$ make foogcc -Wall -ggdb3 -pedantic -std=gnu99 -O0 -o foo foo.c -lm -lpthread -lrtfoo.c:14:1: error: meant ‘;’, i would or ‘(’ prior to ‘int’foo.c: In function ‘main’:foo.c:25:5: warning: layout ‘%s’ expects debate of form ‘char *’, but argument 2 has kind ‘char (*)<20>’ <-Wformat>foo.c:44:9: warning: style ‘%s’ expects debate of kind ‘char *’, but argument 2 has kind ‘char (*)<20>’ <-Wformat>foo.c:48:9: warning: layout ‘%s’ expects debate of kind ‘char *’, but argument 2 has kind ‘char (*)<200>’ <-Wformat>foo.c:64:9: warning: format ‘%s’ expects discussion of type ‘char *’, however argument 2 has type ‘int *’ <-Wformat>make: ***
See more: How To Know If A Guy Likes You In Middle School ? (For Middle School Girls)
Line 14: struct meanings require a ; to end them, therefore the Compiler doesn"t think you"re done, and also isn"t expecting a function definition like main.Lines 25, 44, 48: scanf calls for a tip to where it will save the scanned data. The surname of an array, without any indexing < > brackets, is a tip to the an initial element. Thus, girlfriend don"t require the & because that parameters because that the %s layout specifier.Line 64: You have to use a different format specifier to review ints with scanf. I suggest you review a textbook/tutorial or the scanf documentation.Other notes:Defining printf together P and also scanf as S is a negative idea. Every it walk is minimize readability. Clear, readable password is paramount and also you must never sacrifice clarity or readability since you"re also lazy to type a couple of extra characters.Some of your variable names could be better. In particular, a, b and c. Again, don"t sacrifice clarity. Because that example, a should more than likely be called something favor menu_choice. C is not required (you have the right to put the strcmp speak to directly in the if condition), yet if you desire to usage it, a name choose password_compare would be better.Read up on fgetc. It return an int, no a char. Therefore you should declare ch as an int. This is for this reason fgetc have the right to return every possible char value, and special values choose EOF.Always check return worths of fopen before proceeding. If fopen fails, your paper pointer is NULL, and also trying to do something v it (e.g. Fgetc, fclose) will certainly attempt to access data in ~ the NULL address, which outcomes in undefined behavior (anything or nothing deserve to happen). In your details cases, it will likely an outcome in a regime crash because of seg fault.There"s probably more, however that have to keep you busy for a while.