0

Here's the code I have written in Visual Studio:

#include <iostream>
#include <conio.h>

using namespace std;


class pointer
{
    private:
        int *ptr;
        int **ptr1;
    public:
        int FindSize();
};

int pointer :: FindSize()
{
    ptr1 = &ptr;
    return **ptr1;
}

int main()
{
    pointer point;
    int size = point.FindSize();
    cout << size;
    getch();
    return 0;
}

I am getting this error:

Unhandled exception at 0x00E02BB4 in Pointers.exe: 0xC0000005: Access violation reading location 0xCCCCCCCC

Praveen
  • 8,945
  • 4
  • 31
  • 49
Ankit0047
  • 144
  • 1
  • 10

0 Answers0