/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
typedef struct
{
int content;
} innerStruct;
typedef struct
{
int a;
innerStruct inner[5];
} myStruct;
static myStruct m1;
innerStruct * getMyStructPtr()
{
return &(m1.inner);
}
int main()
{
int id = 0;
int elem = 1;
/* Define a local ptr so I can modify values of the m1 struct */
innerStruct * local_ptr = NULL;
innerStruct * myStruct_ptr = getMyStructPtr(); // seems like my compiler tells me I'm returning an int instead of innerStruct * type
/* Point to one of the elements */
local_ptr = &myStruct_ptr[elem];
local_ptr->content = 123;
return 0;
}