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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:38:46+00:00 2026-05-27T17:38:46+00:00

I have the following problem, the following function is called with conflict initialised to

  • 0

I have the following problem, the following function is called with conflict initialised to NULL.

At the end of foo, conflict takes the correct values. In the case of this example, *conflict should contain the values 4, 8 and 2. Which it does, according to the fprintfs.

However, when I test again in the function calling foo (see second code excerpt), the conflict array hasn’t been modified. I’m not sure why, since I’m passing a pointer to the array, especially since this technique works well for the multiDB and recursive pointers. Any help would be appreciated. (this is not the full code by the way, I’ve only shown the relevant parts). Thanks!

int foo(
    /*==================*/
    uchar* buf, 
    uint* multiDB,
    uint* recursive,
    uint** conflict) {

select_consistent= conflict;
bool finished; 

if (((start_of_scan == 1) && (*multiDB != 1)) || ((start_of_scan== 0) && (select_consistent == NULL))) {
    fprintf(stderr, "Not doing select consistent \n "); 

    finished = TRUE; 
}
else {
    *multiDB=0; 
    fprintf(stderr, "Doing select consistent \n "); 
    finished = FALSE;
    uint n;
    int i = 0 ;
    if (select_consistent == NULL) { /*This is the first round */
          next_round = FALSE; 
        fp = popen("./algorithm '[t(1,[t(2,||),t(3,[t(8,||),t(10,||)])]).t(1,[t(4,||),t(6,||)]).t(1,[t(2,||),t(7,||)])]'", "r"); /* Issue the command.      */
        finished = FALSE; 
    }
    if (next_round == TRUE ) {
        goto parse_records; 
    }

        fscanf(fp, "%lu", &n);
        uint* conflict_ ; 
        if (n!=0) conflict_ =  (uint*) malloc(sizeof (uint) * n); 
        conflict = &conflict_; 
        next_round = TRUE; 
        int j= 0 ; 
        while (fscanf(fp, "%lu", &n) != EOF) {
            if (n == 0) {
                select_consistent=conflict; 
                goto parse_records; 
            }
            else {
                (*conflict)[j] = n; 
            }
             i++;
             j++; 

        }
        finished = TRUE;    
}
parse_records:;
int error;

.... [other code] foo2(multiDB, recursive); 

fprintf(stderr, "Array states %lu %lu \n ", (*conflict)[0], (*conflict)[1]); 
fprintf(stderr, "Array states %lu %lu \n ", (*select_consistent)[0], (*select_consistent)[1]);



return error
}

The function calling foo does it like this:

   uint** conflict = NULL ; 
   error = foo(buf, multiDB, recursive, conflict); 
   fprintf(stderr, "value is %lu \n", (*conflict)[0]); //This is still unitialised.
  • 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-27T17:38:47+00:00Added an answer on May 27, 2026 at 5:38 pm

    It appears that the code has some pointer indirection problems. It seems that conflict is meant to be a single dimensional array of uint. If so, then the initial declaration should be:

    uint* conflict = NULL;
    

    Then pass it like this:

    foo( ... &conflict);
    

    Then in foo allocate it as follows:

    *conflict = (uint*)malloc( ... );
    

    Or if you still want to use conflict_, assign it like this:

    *conflict = conflict_;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Never ran into this problem with jQuery before. I have the following: $(document).ready(function() {
I have the following problem. I have two classes, in this case A and
I have problems with following code: http://lisper.ru/apps/format/96 The problem is in normalize function, which
The problem is the following. We have lots of ajax call via $.ajax function.
I have problems with the following bit of javascript/jquery code: this.droppable = function(){ $('.imageWindow
I have the following problem using template instantiation [*]. file foo.h class Foo {
I have the following problem. I need to pass the hello function to name
I have a quite inconvenient problem. Say that I have the following functions function
I have the following code: // auto_suggest.js function AutoSuggest(textboxElem, resultElem, url) { this.textboxElem =
The following confirmDialog function is called midway through another jquery function. When this confirmDialog

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.