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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:12:47+00:00 2026-05-13T20:12:47+00:00

If we have a char *hello – and the string is hello and i

  • 0

If we have a char *hello – and the string is "hello"

and i do

char *ptr;
ptr = hello;

then ptr will be pointing at 'h', correct?

Now I have just done an assignmnet in this and completed it using the following terms

if i wanted to move the pointer to the next chatachter i would just do ptr++. If i wanted to use the value of the pointer for some check, i would use if(*ptr == '\0')...

When i was doing the assignmnets our teacher gave us some pre built methods, and they used stuff like

*string++ = *s++;

ok, so why would we want to do *string (which gets a value) – and combine it with ++

I hope i make sense in explaining what is not clear. Its just I managed to do the whole assignment with ptr++ to move to next element or *ptr to check its value

  • 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-13T20:12:48+00:00Added an answer on May 13, 2026 at 8:12 pm

    The idiom *s++ means “take the value pointed to, and switch to the next one”.
    This way you can do your check operations in a loop. The assignment *p++ = *q++ copies the value of *q to the place pointed by p, and shifts both p and q to the next place, so the next time you execute *p++ = *q++ the next character will be copied behind the first one. And so on.

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

Sidebar

Related Questions

I have a string as const char *str = Hello, this is an example
If I have a string: char s1[]=hello, how are you?; printf(%d\n,sizeof(s1)); it prints the
I have this in an exercise with pointers: char *str = Hello; int count
I have this code: char* hello = Hello World; std::cout << Pointer value =
Now i have this code, but it always set null UNICODE_STRING str; char *cmp
If I create a string like char string[6] = hello; char* ptr = (char*)
Say I have the following: char* string = Hello, how are you?; Is it
If we have this segment of code: char *i=Hello; cout<<i<<endl; cout<<*i<<endl; cout<<&i<<endl; cout<<*&i<<endl; cout<<&*i<<endl;
I have one requirement in C. char abc[]=hello; char hello[]=world; Using abc whether we
If we have char *val = someString; and then say if(val){ .... } what

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.