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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:20:46+00:00 2026-06-17T10:20:46+00:00

I decided to rewrite what I was doing going backwards to basics: #include <stdio.h>

  • 0

I decided to rewrite what I was doing going backwards to basics:

#include <stdio.h>

int main () {

  int a;
  int b;
  int c;
  int d;
  printf("ta-dah: %i %i %i %i\n", a, b, c, d);

  return 0;
}

I call it me.c and I compile it with gcc me.c and run it with ./a.out.

I get this as a result:

hc$ ./a.out 
ta-dah: 32767 1477090280 0 0

This is a very simple program, and I am not sure where the error is. Any suggestions?

  • 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-17T10:20:48+00:00Added an answer on June 17, 2026 at 10:20 am

    Non-static variables (local variables) are indeterminate. Reading them prior to assigning a value results in undefined behavior.

    Either initialize the variables:

    #include <stdio.h>
    
    int main () {
    
      int a = 1;
      int b = 2;
      int c = 3;
      int d = 4;
      printf("ta-dah: %i %i %i %i\n", a, b, c, d);
    
      return 0;
    }
    

    Output: ta-dah: 1 2 3 4

    Or set them to static:

    #include <stdio.h>
    
    int main () {
    
      static int a;
      static int b;
      static int c;
      static int d;
      printf("ta-dah: %i %i %i %i\n", a, b, c, d);
    
      return 0;
    }
    

    Output: ta-dah: 0 0 0 0

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

Sidebar

Related Questions

I decided not to use an orm and going to use straight ADO.NET for
I decided to learn Assembly language. The main reason to do so is being
I decided to rewrite all our Bash scripts in Python (there are not so
I've decided to rewrite a database I have that is poorly normalized. I've created
I've decided to rewrite most of my distributed server programs in Go to replace
For practice I decided to rewrite string.c in C. I can not find online
I read the article over at http://parsingintro.sourceforge.net/ and decided to try to rewrite it
My team of coworkers and me have decided to rewrite a legacy app in
After reading some items here I have decided to rewrite a little project using
So I've decided to rewrite an old ray tracer I had which was written

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.