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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:25:36+00:00 2026-05-14T08:25:36+00:00

typedef struct { uint32 item1; uint32 item2; uint32 item3; uint32 item4; <some_other_typedef struct> *table;

  • 0
typedef struct
{   
   uint32 item1;
   uint32 item2;
   uint32 item3;
   uint32 item4;

   <some_other_typedef struct> *table;

} Inner_t;

typedef struct
{
   Inner_t tableA;

   Inner_t tableB;

} Outer_t;

Outer_t outer_instance =
{
   {NULL},
   {
    0,
    1,
    2,
    3,

    table_defined_somewhere_else,
   }
};

My question is how to check if tableA is NULL just like the case for outer_instance.

It tried:
if ( tmp->tableA == NULL ). I get “error: invalid operands to binary ==”

/****************************EDIT:Updated code is below *****************************/

I’ve changed the code according to bta’s suggestion but now I’m getting another error
“error: initializer element is not constant” at the line just under the NULL(at items_instance)

typedef struct
{   
   uint32 item1;
   uint32 item2;
   uint32 item3;
   uint32 item4;

} Items_t;

typedef struct
{
   Items_t *itemsA;

   Items_t *itemsB;

} Outer_t;


Items_t items_instance=
{   
   1,
   2,
   3,
   4
};

Outer_t outer_instance=
{
   NULL,
   items_instance

};
  • 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-14T08:25:37+00:00Added an answer on May 14, 2026 at 8:25 am

    In the revised code, you’re setting the first field of outer_instance to NULL, but trying to set the second field to items_instance directly. Since the field has type Items_t* but items_instance has type Items_t, you’re getting a type error.

    You want to set the field to the address of items_instance, so use &items_instance.

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

Sidebar

Related Questions

typedef struct { nat id; char *data; } element_struct; typedef element_struct * element; void
I have the following struct in C++: #define MAXCHARS 15 typedef struct { char
I have the following construction: typedef struct bucket { char *key; ENTRY *data; struct
I've got a structure as follows: typedef struct { std::wstring DevAgentVersion; std::wstring SerialNumber; }
Given a struct, e.g. typedef struct { int value; } TestStruct; Why does the
I have seen many programs consisting of structures like the one below typedef struct
In rpc.h, the GUID structure is declared as follows: typedef struct _GUID { DWORD
I have the below code in stdafx.h. using namespace std; typedef struct { DWORD
In our code, we have a 16-byte packed struct that we call ISOTIME: typedef
typedef void (FunctionSet::* Function)(); class MyFunctionSet : public FunctionSet { protected: void addFunctions() {

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.