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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:35:36+00:00 2026-05-29T22:35:36+00:00

I have a char array. I take its address and pass it to a

  • 0

I have a char array. I take its address and pass it to a function which accepts a double char pointer:

char result[1024+1];
memset(result, 0, sizeof(result));
executeGetQuery(query, &(result));

Function definition: int executeGetQuery(char * query, char ** queryResultData)

I get this compile time error

warning: argument #2 is incompatible with prototype:
prototype: pointer to pointer to char : line 1531
argument : pointer to array[1025] of char

I’ve always passed arrays as pointers in C before. Why am I getting this error? Is my compiler to blame?

EDIT: What is the fix?
EDIT2: I want the function to write something to the result array which is why I am passing a char** instead of char*. What is then another way, the way, to have a function write to a param which I pass in?

  • 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-29T22:35:37+00:00Added an answer on May 29, 2026 at 10:35 pm

    What is the fix?

    In this case (you don’t need the char **) use char * both in the prototype and the calling code

    int executeGetQuery(char *query, char *queryResultData);
    executeGetQuery(query, result);
    

    I’d also include a size argument for protecting against buffer overflows

    int executeGetQuery(char *query, char *queryResultData, size_t len);
    executeGetQuery(query, result, sizeof result);
    

    Edit:

    to change the contents of the array do something like

    int executeGetQuery(char *query, char *queryResultData, size_t len) {
        queryResultData[0] = 'H';  /* changing */
        queryResultData[1] = 'i';  /* the contents */
        queryResultData[2] = '\0'; /* of the array */
    }
    

    You can see the change in the calling function

    executeGetQuery(NULL, result, sizeof result);
    printf("result is now %s\n", result); /* should print "Hi" */
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an char array b[20] which i want to write into a file
I have a big lump of binary data in a char[] array which I
Suppose i have array of characters. say char x[100] Now, i take input from
I have a string which was converted to a char array and stored in
I have a char array in a C application that I have to split
I have a char array buffer that I am using to store characters that
I have taken char data into database into array. now i want to convert
I currently have the dynamic array: char *myData[500][10]; //myData is the name of an
Have an array of chars like char members[255]. How can I empty it completely
if I have an array of pointers like char **lines, how can i determine

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.