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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:07:42+00:00 2026-06-15T05:07:42+00:00

I am new to C. This code runs on a Flyport module and compiles

  • 0

I am new to C. This code runs on a Flyport module and compiles on their own IDE but I should think my error should be easy to spot for anyone familiar with C.

I can’t get this code to compile despite changing almost everything, what am I doing wrong?

char string_serial[50]="starting Value";    

if (string_serial[0] = "*")
        {   

            UARTWrite(2,"First Char OK");
            UARTWrite(2,"\r\n");

            else 

            UARTWrite(2,"First Char NOT OK");
            UARTWrite(2,"\r\n");

        }

If it’s not obvious I am trying to check if character 0 in the array is *.

Thanks

  • 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-15T05:07:44+00:00Added an answer on June 15, 2026 at 5:07 am

    The syntax for if/else conditions is wrong

    The syntax should be

     if(condition)
      {
      }
    
      else
      {
      }
    

    For your specific code it should be

    if (string_serial[0] == '*')
            {   
    
                UARTWrite(2,"First Char OK");
                UARTWrite(2,"\r\n");
             }
    
    else 
            {
                UARTWrite(2,"First Char NOT OK");
                UARTWrite(2,"\r\n");
    
            }
    

    The = operator is assignment, it assigns the value (returning true when successful). What you need is == (for comparing).

    Also use single quotes for characters as shown in the code above.

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

Sidebar

Related Questions

This code runs perfectly on Java but when I run this on Android platform,
My code is this: description = contents.match(/===========(.*?)What's New in this Version/m)[1].strip The code runs
This code runs well in my locally but gives file not found exception when
Consider this code: new Ajax.Request('?service=example', { parameters : {tags : 'exceptions'}, onSuccess : this.dataReceived.bind(this)
I'm guessing this must be new functionality as this code fail on my iOS4
Having this code: using (BinaryWriter writer = new BinaryWriter(File.Open(ProjectPath, FileMode.Create))) { //save something here
Given this code: var arrayStrings = new string[1000]; Parallel.ForEach<string>(arrayStrings, someString => { DoSomething(someString); });
Consider this code: var img = new Image(); img.onload = function() { console.log(this.width); };
This Code: Something = new Guid() is returning: 00000000-0000-0000-0000-000000000000 all the time and I
This code:: xslProcessor = new XSLTProcessor(); xslProcessor.importStylesheet(xsl); result = xslProcessor.transformToFragment(xml, document); works fine in

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.