• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

scope of variables in Arduino C

Q&A Forum › Category: Arduino › scope of variables in Arduino C
0 Vote Up Vote Down
Stewart Lindenberger asked 10 years ago

I know that variables defined at the top of a sketch are globally accessible, and those defined inside the loop() function are only accessible in that function, and variables defined inside a for loop are only accessible within that for loop. but what about variables defined inside the setup() section? Are they only available within the setup section?

1 Answers
0 Vote Up Vote Down
Rui Santos Staff answered 10 years ago

Hi Stewart, variables defined within the setup() are only available in the setup() function. The setup() is just like any other function, so the same rules apply. I hope this helps!

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Smart Home with Raspberry Pi, ESP32, and ESP8266 V1.6 September 9, 2025
  • [eBook Updated] Learn LVGL: Build GUIs for ESP32 Projects – Version 1.5 July 7, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

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.