Declaration Specifiers Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow
Declaration Specifiers Error In C
Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow error expected declaration specifiers or '...' before is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Expected declaration specifier error error expected declaration specifiers or ‘...’ before string constant in function up vote -2 down vote favorite New to the exchange so sorry if my formatting is off. I am getting an error for "expected declaration specifiers" This is in the is_prime function I have defined at the bottom. Can you shed
Error Expected Declaration Specifiers Or ‘...’ Before ‘size_t’
some light on this error and how to correct it? #include
Error Expected Declaration Specifiers Or ‘...’ Before ‘*’ Token
0) { return 1; } else if(k%j == 0) { return 0; break; } } } here are the output errors main.c: In function 'is_Prime': main.c:29:1: error: expected declaration specifiers before 'for' for(j = 2; j < k; j++) ^ main.c:29:12: error: expected declaration specifiers before 'j' for(j = 2; j < k; j++) ^ main.c:29:19: error: expected declaration specifiers before 'j' for(j = 2; j < k; j++) ^ main.c:42:1: error: expected declaration specifiers before '}' token } ^ main.c:42:1: error: expected '{' at end of input main.c: In function 'main': main.c:42:1: error: expected declaration or statement at end of input c share|improve this question edited Mar 1 '15 at 21:57 asked Mar 1 '15 at 21:21 Matt C 12 1 It's no use apologising about the formatting. If you had done so, you would have immediately seen where the missing closing, and opening braces are. Formatting isn't just to make the code "look nice", it's truly essential. Down voted. –Weather Vane Mar 1 '15 at 21:28 I was apologizing about the formatting of my question not the code. I know most forums have a general way they expect a question to be asked. –Matt C Mar 1 '15 at 21:32 Also, why do you have "else(k%j == 0)"? Did you intend to have 'else if'? You need to declare "int j" inside the function. The break in the else block is superfluous (as is the for loop, as written), since it will always return from either the if or the else. &nd
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site error expected declaration specifiers or ‘...’ before ‘znode op’ About Us Learn more about Stack Overflow the company Business Learn more
Error Expected Declaration Specifiers Or '...' Before 'size_t'
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss error expected declaration specifiers or '...' before numeric constant Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Two or more http://stackoverflow.com/questions/28799243/expected-declaration-specifier-error-in-function data types in declaration specifiers error [closed] up vote 31 down vote favorite 3 I am pretty new to C. I am getting this error: incompatible implicit declaration of built-in function ‘malloc’ Even when I fix the code based on the answers to include
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this http://stackoverflow.com/questions/10747621/expected-declaration-error-c-error site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Expected declaration specifiers declaration error( c error) up vote 2 down vote favorite this is my code #include