I am trying to dump the memory of my c++ app.

#include <iostream>
#include <fstream>
using namespace std;

int main () {
  ofstream myfile;
  myfile.open ("example.txt");
  myfile << "Writing this to a file.\r\n";
  int *p;
  *p = 25;
  char b[] = "hello";
  int a;
  for (a=0; a==-1; *(p++)){
  myfile.open ("example.txt");
  myfile << p <<"    "<< *p <<"\r\n";
  return 0;

I get

Writing this to a file.

how to find a size of pointer/array? :D


That's a little bit misleading, the sizeof operator won't work for sizes unknown at compile time. In this case, the size is certainly dynamic and what he'll likely get from sizeof(dynamic_array) is (4), or, the size in bytes of the pointer to its base address.

Note how this is different:

int a[20] = 0;
sizeof(a); // will return 20, because the size is known by the compiler