Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6594257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:47:15+00:00 2026-05-25T17:47:15+00:00

I seem to be having a problem setting the values of an array inside

  • 0

I seem to be having a problem setting the values of an array inside a structure with a meaningless error spat out of the compiler:

expected primary-expression before ‘{‘ token

I understand that a structure must “exist” to accept values, and it exists as a pointer to one. I would like you to explain to me what i am doing wrong and how to achieve my objective.

struct EventCheckData {
  unsigned long refresh_time;
  unsigned long last_execution_ms; //Can also serve to delay at startup
  byte signal_type;
};

struct ClockData {
    struct EventCheckData event_array[4];
    byte event_count;
    unsigned long last_absolute_time;
    UISignal *warning_signals;
}; 



 void ResetClock(UISignal *warning_signal, struct ClockData *clock_data, unsigned long absolute_time) { 
    if(SignalCheckValue(warning_signal, RESET_CLOCK, 1)) {
        extern volatile unsigned long timer0_overflow_count;
        timer0_overflow_count = 0;
        clock_data->last_absolute_time = absolute_time;
        clock_data->event_count = 3;
        (clock_data->event_array)[0] = { .refresh_time = 3000UL, .last_execution_ms = 0UL, .signal_type = WATER_PUMP_ON};
//      clock_data->event_array[1] = {10000UL, 0UL, EXPORT_LOG};
//      clock_data->event_array[2] = {100000UL, 0UL, EXTERNAL_CONNECTION};
        SignalSet(warning_signal, RESET_CLOCK, 0);
    }
}

Thank you
Paulo Neves

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:47:15+00:00Added an answer on May 25, 2026 at 5:47 pm

    (clock_data->event_array)[0] = { .refresh_time = 3000UL, .last_execution_ms = 0UL, .signal_type = WATER_PUMP_ON}; is not initialization. It is assignment.

    And you cannot use initializer syntax in assignment.

    With C99, you should be able to use a compound literal, like

    (clock_data->event_array)[0] = (struct EventCheckData){ .refresh_time = 3000UL, .last_execution_ms = 0UL, .signal_type = WATER_PUMP_ON};
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm really having a problem finding out how to fix this. I cannot seem
I seem to be having a problem setting multiple JAR files to the classpath
I seem to be having a problem with checking for list equality. In my
Okay, I seem to be having a problem. I'm trying to create a twicker
I'm having a problem with my Seam code and I can't seem to figure
I'm having a problem with my site http://artygirl.co.uk/pixie/about/ I can't seem to get the
I'm having trouble with MySQL or Python and can't seem to isolate the problem.
I seem to be having a problem with styling my links for chrome, yet
i having problem in converting this C# code into VB.net. The loadLecturer seem to
I'm having a problem setting up an event on a form. Here's the setup:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.