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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:06:34+00:00 2026-05-31T06:06:34+00:00

I encountered a for loop where the condition is the parameter (p) itself. When

  • 0

I encountered a for loop where the condition is the parameter (p) itself. When will the loop stop? I don’t see this case in my C++ books.

for (PDFS *p = e->prev ; p ; p = p->prev) {
    push_back (p->edge);
    edge[p->edge->id] = vertex[p->edge->from] = vertex[p->edge->to] = 1;
}
  • 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-31T06:06:36+00:00Added an answer on May 31, 2026 at 6:06 am

    The loop will stop when p is NULL. In the loop, you don’t need to explicitly check for the condition p !=NULL, or in C++11, p != nullptr.

    The similar code is also written you’ve null-terminated c-string:

     char str[] = "its null-terminated string";
     for(size_t i = 0 ; str[i] ;  ++i)
            std::cout << str[i] << std::endl;
    

    In this case, you don’t need to check for the condition i < strlen(str) or something like that.

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

Sidebar

Related Questions

I'm encountered with this situation: (fn produce [] '(val0 val1)) ;... (loop [ arg0
I've been trudging through some Javascript code and encountered this loop for (var w
When reviewing, I sometimes encounter this kind of loop: i = begin while (
I encountered the following ddl in a pl/sql script this morning: create index genuser.idx$$_0bdd0011
I encountered this term Hindley-Milner , and I'm not sure if grasp what it
I've got this - possibly trivial - loop/combinations problem similar to binary combinations. I
I encountered a problem here. I'm using C++ multiset. This is the test file.
This is an example of a pattern I've encountered a lot recently. I have
This is probably obvious but I'm getting this error: A PHP Error was encountered
I've encountered this before and I have a fair understanding of scope though not

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.