case of the missing pointer in C

Discussion in 'Software' started by longbowrocks, May 3, 2010.

  1. longbowrocks

    longbowrocks Private E-2

    A pointer has been disappearing in Visual Studio C. I call the following line:
    return addVal(fp, value, root);

    which calls this:

    struct node** addVal(FILE** fp, int value, struct node** root){
    FILE* rfp = *fp;
    fprintf(rfp, "%d\n", value);
    return insert(value, root);
    }


    and that's all that's important, because root disappears when I get to the line:
    FILE* rfp = *fp;

    the structure of root until that line is:
    root = 0x0012fd74
    *0x0012fd74 = 0x00346f90
    *0x00346f90 = node
    node.value = 2
    node.next = 0x00000000

    the structure of fp is:
    fp = 0x0012ff48

    starting at that line, root is displayed as:
    root = 0x0012fd74
    *0x0012fd74 = 0xcccccccc

    root was passed into the function containing the return statement from main().
     
    Last edited: May 3, 2010

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds