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 8837075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:38:09+00:00 2026-06-14T09:38:09+00:00

I am getting: error: expected expression before ‘{‘ token for the line I’ve commented

  • 0

I am getting: “error: expected expression before ‘{‘ token” for the line I’ve commented before. If the struct is already defined why would it need a “{” before token. Thanks for any help you can provide.

struct sdram_timing {
    u32 wrdtr;
    u32 clktr;
};

int calibration(void);
unsigned char read_i2c_cal(void);
static unsigned int eepcal[15];

main() {
    DQS_autocalibration();
}

int calibration(void)
{
    struct sdram_timing scan_list[30];

    read_i2c_cal();
    if(eepcal[0] == 0){

       scan_list = {{eepcal[1], eepcal[2]}, {-1, -1}}; // <-- PROBLEM LINE

        }
        else {
            //foo
        }

    return 0;
}

unsigned char read_i2c_cal(void) {
    eepcal[0] = 0;
    eepcal[1] = 02;
    eepcal[2] = 03;
}
  • 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-06-14T09:38:10+00:00Added an answer on June 14, 2026 at 9:38 am

    The error is because you can’t assign an array that way, that only works to initialize it.

    int arr[4] = {0}; // this works
    int arr2[4];
    
    arr2 = {0};// this doesn't and will cause an error
    
    arr2[0] = 0; // that's OK
    memset(arr2, 0, 4*sizeof(int)); // that is too
    

    So applying this to your specific example:

    struct sdram_timing scan_list[30];
    scan_list[0].wrdtr = 0;
    scan_list[0].clktr = 0;
    

    or you could use memset the same way, but instead of sizeof(int) you need size of your structure. That doesn’t always work… but given your structure, it will.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting an error as expected expression before '=' token. #define RMH_MAX_UNENCODED_LENGTH= (RMH_MESSAGE_MAX_SIZE
Here is my code. I keep getting this error: error: expected primary-expression before ')'
I keep getting an expected identifier error at this line in my code =/
I'm currently getting the following compile errors: In function 'int main()': error: expected primary-expression
I keep on getting this error error: expected specifier-qualifier-list for core data code im
I am getting this error While running this LoadError: Expected /home/user/Desktop/Tripurari/myapp/app/models/host.rb to define Host##
Getting Expected ',' or '{' but found '#44559' error. My code looks like this:
C99 gcc I keep getting this error. I have a struct outside main. And
When using XPath expression descendant::div with selectNodes in IE i am getting an error
getting error while try to start service

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.