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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:25:02+00:00 2026-06-14T07:25:02+00:00

Please help me understand what I am doing wrong with my double pointer arithmetic.

  • 0

Please help me understand what I am doing wrong with my double pointer arithmetic. I know I clearly doing something incorrect but what? Look at the line where I marked, “bad pointer”. My intuition told me that this should work, but I guess not. Programmed in C.

/*
 *This function searches for prefixes within the string array.
 *@param stringArray array containing strings
 *@param searchPrefix a string or characters to search for at beginning of string
 *@return void
 */
 void prefixSearch(char* stringArray[SIZE], char* searchPrefix){
int count = strlength(searchPrefix);//size of the prefix search
while(count > 0){
    if(**stringArray == *searchPrefix){
        printf("%c match %c\n", **stringArray, *searchPrefix);
        **stringArray++;//want to move to next character, instead get bad pointer.
        *searchPrefix++;//moves to next char
    }else{
        stringArray++;//no match, go to next string
    }
    count--;//decrement
}

}

  • 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-14T07:25:04+00:00Added an answer on June 14, 2026 at 7:25 am

    The * and ++ operators have the same precedence, and right-to-left associativity, so the line that’s not working parses like this:

    *(*(stringArray++));
    

    I don’t actually understand your code, but that can’t be what you intended since the dereference operators have no effect. Presumably you wanted this instead:

    (**stringArray)++;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please help understand what I'm doing wrong here. I guess escaping is wrong, but
I'm probably doing something wrong, being a newbie. Could you please help me out?
Can someone please help me to understand what Am I doing wrong ? I
Please help me understand where I am going wrong so much so that I
I'm asking you for help, because I can't understand what I'm doing wrong. I
Please help me understand the following code snippet :- def any(l): whether any number
Please help me understand why add1() and add4() report errors and why add2() and
Please help me understand this recursive function... var stack = Array; function power(base, exponent){
I'm a noob; please help me understand this authentication config / bindings stuff that
the following code is not behaving like I would expect. Please help me understand

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.