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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:05:01+00:00 2026-05-13T07:05:01+00:00

while (curr_data[1] != (unsigned int)NULL && ((curr_ptr = (void*)curr_data[1]) || 1)) Two part question.

  • 0
while (curr_data[1] != (unsigned int)NULL &&
    ((curr_ptr = (void*)curr_data[1]) || 1))

Two part question.

What will (curr_ptr = (void*)curr_data[1]) evaluate to, logically. TRUE?

Also, I know its rather hack-ish, but is the while statement legal C? I would have to go through great contortions to put the assignment elsewhere in the code, so I’d be really nice if I could leave it there, but if it’s so egregious that it makes everyone’s eyeballs burst into flames, I’ll change it.

  • 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-13T07:05:01+00:00Added an answer on May 13, 2026 at 7:05 am

    To answer your questions:

    1. It will evaluate to true if curr_ptr isn’t set to NULL (i.e. curr_data[1] isn’t 0).
    2. I believe it’s legal, but there are bigger problems with this line of code.

    Anyway, I’m assuming you didn’t write this code, because you’re debating about leaving it in vs. taking it out. So I want you to find out who wrote this line of code and introduce them to a heavy blunt object.

    1. (unsigned int)NULL is ridiculous. Why would you do this? This will probably be the same as just writing 0 (not sure if that’s guaranteed by the standard).
    2. What kind of data is in curr_data[1] if it’s being cast to a pointer (and pointers are being cast to it)? If it’s supposed to be holding a pointer as an integral type, you should use the type intptr_t or uintptr_t provided in <stdint.h> for that purpose (if you’re compiler doesn’t support C99 ptrdiff_t may be an acceptable substitute).
    3. The || 1 at the end seems to be redundant. If curr_ptr = (void*)curr_data[1] would have evaluated to false, we would have caught that in the first condition.

    It may be a pain in the ass, but seriously reconsider rewriting this line. It looks like an entry in the IOCCC.

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

Sidebar

Ask A Question

Stats

  • Questions 289k
  • Answers 289k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Well, this works for me (tested on Chrome 4, FireFox… May 13, 2026 at 5:30 pm
  • Editorial Team
    Editorial Team added an answer I've only skimmed your code, but... So, near the top… May 13, 2026 at 5:30 pm
  • Editorial Team
    Editorial Team added an answer Since Git1.6.3: When the user does not tell "git push"… May 13, 2026 at 5:30 pm

Related Questions

As a part of an assignment, I need to write two functions: a function
I came across this method to produce a Javascript stack trace (to fix an
In C#, what's the best way to get the 1st digit in an int?
Ok, I'm new at C++. I got Bjarne's book, and I'm trying to follow
I have a javascript function that is being built to animate the collapse of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.