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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:43:12+00:00 2026-05-14T15:43:12+00:00

In a book I am reading there is a piece of code : string

  • 0

In a book I am reading there is a piece of code :

string x;
size_t h=0;
for(const char* s=x.c_str();*s;++s)
    h=(h*17)^*s;

Regarding this code, I have two questions:

  1. how can *s be a condition? what does it mean?

  2. what does "h=(h*17)^*s" mean?

Thanks for help!

  • 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-14T15:43:12+00:00Added an answer on May 14, 2026 at 3:43 pm
    1. how can *s be a condition? what does it mean?

    It means “while the value pointed to by s is not zero.” C strings are null-terminated, so the last character in the string returned by c_str() will be the null character (\0, represented by all bits zero).

    1. what does “h=(h*17)^*s” mean?

    It multiplies h by 17 then xors it with the value pointed to by s.

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

Sidebar

Related Questions

I am reading a .NET book, and in one of the code examples there
I was reading a book on templates and found the following piece of code:
I have the following text tooooooooooooon According to this book I'm reading, when the
I am reading The thread building block book. I do not understand this piece
I'm reading the book LINQ Pocket Reference and there is a particular example (slightly
Currently reading quite a heavy WCF book. I have used it myself in production
I mentioned in one of my earlier questions that I'm reading book C++ Coding
I am reading a book about python. There is a sample. The first line
I'm reading a book about SQL. In that book there's the term Ad Hoc
I was reading a book on programming skills wherein the author asks the interviewee,

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.