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

  • Home
  • SEARCH
  • 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 8437967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:34:45+00:00 2026-06-10T07:34:45+00:00

I populated a structure(ORDER_EXPIRY_TP *OrderReqXml) and now I want to check whether structure conatains

  • 0

I populated a structure(ORDER_EXPIRY_TP *OrderReqXml) and now I want to check whether structure conatains any value or not? Here is my code:

OrderReqXml->fIntOrderNumbe =at_int_ord_req->fIntOrderNumber;

OrderReqXml->dLocationCode = 0;
OrderReqXml->dQzUser = at_int_ord_req->dUserId
OrderReqXml->dSuperUserId = 0;

So basically i want 2 check whether OrderReqXml is null or not.

  • 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-10T07:34:46+00:00Added an answer on June 10, 2026 at 7:34 am

    Really depends on what you are trying to achieve.

    If you allocate your struct like this:

    Order* OrderReqXml = malloc(...);
    

    then, you should indeed check for the pointer being != NULL before assigning values to your struct. A good way would be:

    Order* OrderReqXml = malloc(...);
    if (OrderReqXml != NULL) {
      // fill data
    } else { /* error handling */ }
    

    If you obtain the pointer from somewhere else, e.g. from a static structure in memory and you want to check whether the struct has been populated or not, you need to check the single struct elements:

    bool structIsNotFilled(Order* o) {
      return ((o->fIntOrderNumber == 0) &&
              (o->dLocationCode == 0) &&
              (o->dQzUser == 0) &&
              (o->dSuperUserId == 0))
    }
    

    The question then is however, if you wanted to trust this struct in memory to be initialized with zeros. (You must not trust memory allocated with malloc() to be initialized to zero.)

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

Sidebar

Related Questions

last time I asked how to populate a data structure here . Now I
Using a populated Table Type as the source for a TSQL-Merge. I want to
I have an JPanel populated with several opaque custom components. Now I would like
I'm very new to xml so I hope I'm not asking any silly question
I want to know how to populate the following hash structure: my $hash =
I have a c# tree structure that will be passed to my JS code
Here is the relevant data structure and associations: User (has_many completions) - id Quest
My problem is that I want a grid that is populated with a set
I have a table with this structure: [ID] [int] IDENTITY(1,1) NOT NULL, [ParentID] [int]
I have a grid populated as in the following structure, Name Qualification Address xx

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.