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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:42:15+00:00 2026-05-23T09:42:15+00:00

I came across what I thought was a unique syntax that I’ve never seen

  • 0

I came across what I thought was a unique syntax that I’ve never seen before (I mostly come from a C++ background). I’m not sure what the code is below. My guess is that it’s some sort of unique way of defining a struct, but if someone could clearly explain what they’re doing here, that would be a great help!

static Foo f =
{

    .a = {DEFAULT_FOO},
    .b = DEFAULT_BAR,
    .c[0] = { 0 }

#ifdef BAR
    ,
    .c[1] = { 0 },
    .c[2] = { 0 }
#endif
};
  • 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-23T09:42:15+00:00Added an answer on May 23, 2026 at 9:42 am

    This is C99 initialization syntax.

    Note that a final comma is ok in C99, and the snippet could have been written

    static Foo f =
    {
        .a = {DEFAULT_FOO},
        .b = DEFAULT_BAR,
        .c[0] = { 0 },
    #ifdef BAR
        .c[1] = { 0 },
        .c[2] = { 0 },
    #endif
    };
    

    Note comma after .c[0] and .c[2].

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

Sidebar

Related Questions

I just came across something that I have not seen before and I thought
I recently came across an IE7 only bug that I thought I'd share so
I recently came across something that I thought I understood right off the bat,
I recently came across a piece of code, that I thought was very funny.
I came across http://api.imgur.com and thought that would be a usefull tool to use
I came across some MATLAB syntax with a colon that I don't fully understand.
I thought I understood Java generics pretty well, but then I came across the
I came across a printed article by Bertrand Meyer where he states that tests
I came across a controller in an older set of code (Rails 1.2.3) that
I came across the Borg design and thought it would fit well with what

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.