Author Topic: Weird output when using Code::Blocks  (Read 3264 times)

Offline PsychadelicGumballMachine

  • Multiple posting newcomer
  • *
  • Posts: 15
Weird output when using Code::Blocks
« on: May 15, 2022, 05:44:58 pm »
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);
    return(0);
}

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.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Weird output when using Code::Blocks
« Reply #1 on: May 15, 2022, 06:13:07 pm »
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;
Ask elsewhere for more information.