What is wrong in my code below?
There are no errors or warnings when I compile it by Dev C++ compiler. But after I run my program there is execution error and following return value text:
Process exited after 5.1 seconds with return value 3221225477
Press any key to continue . . .
Any idea what is wrong?
When I use debug feature, error occurs in that line:
printf("Value of (*pointerToMyOwnStructPointer)->a = %d\n", (*pointerToMyOwnStructPointer)->a);
My code is:
#include <stdio.h>
#include <stdlib.h>
typedef struct{
    int a;
    int b;
}myIntegers_t;
int main (void)
{
    myIntegers_t *myOwnStructPointer = NULL;
    myIntegers_t **pointerToMyOwnStructPointer = NULL;
    myOwnStructPointer = (myIntegers_t*)malloc(sizeof(myIntegers_t));
    if (myOwnStructPointer > 0)
    {   
        myOwnStructPointer->a = 2;
        myOwnStructPointer->b = 8;
        printf("Value of myOwnStructPointer->a = %d\n", myOwnStructPointer->a);
        printf("Value of myOwnStructPointer->b = %d\n", myOwnStructPointer->b);
        pointerToMyOwnStructPointer = (myIntegers_t**)myOwnStructPointer;
        printf("\n");
        printf("Value of (*pointerToMyOwnStructPointer)->a = %d\n", (*pointerToMyOwnStructPointer)->a);
        printf("Value of (*pointerToMyOwnStructPointer)->b = %d\n", (*pointerToMyOwnStructPointer)->b);  
    }
    else
    {
        return -1;
    }
    return 0;
}
 
     
     
     
     
     
    