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 8221359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:53:32+00:00 2026-06-07T13:53:32+00:00

In a tutorial it said If you use the goto statement to jump into

  • 0

In a tutorial it said

If you use the goto statement to jump into the middle of a block, automatic variables within that block are not initialized.

Then in the below code if i can be accessed/declared then why it is not initialised?

int main()
{
   goto here;
   {
     int i=10;
     here:
      printf("%d\n",i);
   }
   return 0;
}

ps:output is some garbage value.

  • 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-06-07T13:53:33+00:00Added an answer on June 7, 2026 at 1:53 pm

    There’s no logic behind your question “if i can be accessed, why…”. Being able to “access i” isn’t an argument for or against anything. It just means that the printf statement is in the same scope as i. However, since you jumped over the initializer, the variable is uninitialized (just as your tutorial says).

    Reading an uninitialized variable is undefined behaviour, so your program is ill-formed.

    The memory for the variable i has already been set aside at compile time, since the variable is known to exist inside the inner block. The memory doesn’t get allocated dynamically, as you may be imagining. It’s already there, but it never got set to anything determinate because of the goto.

    Rule of thumb: Don’t jump across initializers.

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

Sidebar

Related Questions

I just started looking into Raphael, and every tutorial said that you may draw
I have followed this tutorial which allowed me to create a Silverlight DataGrid that
I'm following a tutorial on how to use Interface Builder from Chapter 2 of
I have searched and searched and all I could see was that to use
I was following the tutorial on how to configure Pentaho to use mysql databases
I tried to search forum topics to find a tutorial that will guide me
When should I use an <h:outputLink> instead of an <h:commandLink> ? I understand that
I'm trying to use a PHP login form tutorial I found somewhere online, and
I followed the tutorial on https://dev.twitter.com/docs/auth/implementing-sign-twitter to use OAuth on my homepage. Everything worked
The beginner tutorial I've followed said I should create a namespace on the window,

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.