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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:38:17+00:00 2026-06-06T16:38:17+00:00

I use only C99, and, yesterday, I heard that it was impossible to mix

  • 0

I use only C99, and, yesterday, I heard that it was impossible to mix several declarations and initializations in ANSI C. Thus, codes like this :

unsigned x = 42, y = 21;
double e = 3.14;

Would be, with gcc’ -pedantic flag :

unsigned x, y;
double e;

x = 42, y = 21;
e = 3.14;

I’m surprised, because I didn’t find any information about that in C89 draft, and a code like this works fine…

unsigned x = 42, y = 21;
double e = 3.14;

Sorry, it seems to be a trivial question, but I did some research, and nothing told me about this rule…
Is it true ?

  • 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-06T16:38:19+00:00Added an answer on June 6, 2026 at 4:38 pm

    An initialization is a part of declaration, so you can do initialization in a declaration in both C89/C99:

    /* Valid in C89 and C99. There are no statement, only declarations */
    unsigned x = 42, y = 21;
    double e = 3.14;
    

    What you cannot do is to mix statements and declarations in C89:

    /* Not valid in C89, valid in C99: mixing declarations and statements */
    unsigned x, y;
    x = 42, y = 21;
    
    double e;
    e = 3.14;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I heard that static methods should use only static variables in java. But, main
I use only classes and never use IDs. Many people like to use IDs
I am writing boot code where I would like to use only relative addressing
i would like to use only certain functions from math.h (WITHOUT including the entire
1.Hi, I have a internal use only file upload script that uploads the files
I would like to use only the perishable_token feature from authlogic on this model
Is it possible to use only several starting characters of a field value as
Threads in ansi c99. I'm looking for something fast and something that is cross
I use only jQuery for writing JavaScript code. One thing that confuses me is
I want to Use only the HTML Controls on my page. For that i

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.