As you wrote, to allocate space for all_accounts_dyn you used
*all_accounts = malloc(sizeof(struct Account)*num_accounts);
It is correct due to the double pointer.
 The double pointer takes the address of pointer all_accounts_dyn
 The returned address of malloc is assigned to all_accounts_dynall_accounts_dyn that is *all_accounts inside the dynamicStruct function.
 So when you loop to init the struct you have to first dereference the double pointer and the dereference all_accounts_dyn items.
    for(int i = 0; i<num_accounts;i++)
    {
        (*all_accounts)[i].accountNo = i;
        printf("initialized %d\n", (*all_accounts)[i].accountNo);
    }