User forums > General (but related to Code::Blocks)

Weird output when using Code::Blocks


I am pretty new to C Programming and was practicing using pointers.  Here's the code I had:

#include <stdio.h>
#include <stdlib.h>

int main()
    int number = 15;
    int *pnumber = NULL;

    *pnumber = &number;

    printf("%p\t %p\t %d.", (void*)&pnumber, pnumber, *pnumber);

However upon running the program, I got this:
 0 [main] Untitled1 1556 cygwin_exception::open_stackdumpfile: Dumping stack trace to Untitled1.exe.stackdump

Process returned 35584 (0x8B00)   execution time : 0.070 s
Press any key to continue.

I don't know what this means and it appears to have nothing to do with what I wrote.  Any help would be greatly appreciated.

Miguel Gimenez:
C::B is not a compiler, and this forum is not a general programming board.

You are dereferencing a NULL pointer here:

--- Code: ---*pnumber = &number;

--- End code ---
Ask elsewhere for more information.


[0] Message Index

Go to full version