Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7185145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:21:05+00:00 2026-05-28T18:21:05+00:00

I am receiving the following error: error: expected constructor, destructor, or type conversion before

  • 0

I am receiving the following error:

error: expected constructor, destructor, or type conversion before ‘(’ token

Here is the source code that I have written:

   void setup() {
     pinMode(1,OUTPUT);
   [...]
     pinMode(13,INPUT);
   }
   int i = 1;
   bool pushed = digitalRead(13);
   bool val = 0;
   randomSeed(analogRead(0));
   void loop() {
     if (pushed == 1) {
       for (i = 1; i < 9; i++) {
         val = random(2);
         digitalWrite(i,val);
       }
     }
   }

The variables and the setup are OK; the error is located on the for line. Can anyone tell me how to fix this?

(edit : added the begining of the script, and sorry for the presentation (first question here)

(edit : looks like the error is not in the “i” definition. I’m using an Arduino UNO SMD Edition, if that helps (and the arduino alpha 0022 linux version of the IDE) )
EDIT: okay guys, solved now. It appears that my version of Arduino IDE was not completely downloaded, and that I put the randomSeed in the wrong place (it should be in the setup function.) (when i did put it in the setup function before updating, it shown an error message, saying /opt/arduino/lib/math.h was missing something (or something like that, i don’t have the full message) ). Thanks for your help and i hope i’ll be able to help you in arduino soon!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:21:06+00:00Added an answer on May 28, 2026 at 6:21 pm
    for (int i = 1; i < 9; i++)
    

    is valid in C99/C11 but not valid in C89.

    If you use a C89 compiler you have to define i outside the for loop clauses:

    int i;
    for (i = 1; i < 9; i++)
    

    Also in C89, all declarations have to follow the left brace of a block, you cannot freely mix declarations and statements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am receiving the following error from the code below. You have an error
I am receiving the following error in my code (c#, .Net 3.5, VS2008) when
I am receiving the following error and cannot find the problem: You have an
I have recently been receiving the following error whenever I am asked to supply
I am receiving the following error: System.InvalidOperationException was unhandled Message=The type 'Judge' is not
I am receiving the following error: Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'Munchkin.Model.PlayerProfiles.Profile'. An
I am receiving the following error in my Lisp code: value (PROBLEM1 (+ N
I'm receiving the following error on this line of code select.up().appendChild(sw); With error SCRIPT438:
Background I'm receiving the following error when trying to render a partial view in
I am receiving the following error in PHP Notice undefined offset 1: in C:\wamp\www\includes\imdbgrabber.php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.