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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:13:10+00:00 2026-06-07T06:13:10+00:00

I could not come to the reason why i m getting compilation error to

  • 0

I could not come to the reason why i m getting compilation error to this code?Would be great help if someone clarified it.

int main()
{
  struct xx
  {
    int x;
    struct yy
   {
    int z;
    struct xx *p;
    };
   struct yy *q;
  };
}
  • 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-07T06:13:12+00:00Added an answer on June 7, 2026 at 6:13 am

    In C language you are not allowed to declare struct types inside other struct types without immediately introducing a data field. I.e. struct declaration and data field declaration should be done in one step (as one declaration). You violated that rule: your struct yy definition just sits inside struct xx definition for no reason whatsoever.

    Either pull the struct yy definition outside of struct xx, or make sure that struct yy definition immediately declares a field of xx.

    For example, this implements the same intent, but does it correctly

      struct xx
      {
        int x;
        struct yy
        {
          int z;
          struct xx *p;
        } *q; // `struct yy` definition is immediately used to declare field `q`
      };
    

    However, usually in C language there’s no reason to create nested struct definitions. It is usually a better idea to define structs at the same level, without any nesting

    struct yy
    {
      int z;
      struct xx *p;
    };
    
    struct xx
    {
      int x;
      struct yy *q;
    };
    

    Why didn’t you do it that way from the beginning? What was the point of defining these structs in “nested” fasion?

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

Sidebar

Related Questions

I have come across the following jQuery code but could not understand it. What
I could not understand this error, the scenario is: This is the directory structure:
I could not figure out how to get the white fill for this ggplot2
I could not find a clear answer to this question elsewhere, so I'll try
I was wondering if someone could point me in the right direction with this
I've just come across some code in Three20 that looks like this: SEL sel
Could not load file or assembly 'EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
I could not integrate the Test Flight sdk in my ios App for crash
I could not find a way to make a RTL paragraph in Docx using
I could not find the function that returns the name of the cell referenced.

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.