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

  • SEARCH
  • Home
  • 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 7759883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:44:20+00:00 2026-06-01T13:44:20+00:00

When I’m trying to compile this code with gcc version 4.6.3 on linux with

  • 0

When I’m trying to compile this code with gcc version 4.6.3 on linux with -Wall flag I’m getting these two warnings:

  1. It points to cmd[1]=cmd2send;

    warning: assignment makes pointer from integer without a cast [enabled by default]

  2. It points to the variable static unsigned char *cmd[65]

    warning: variable ‘cmd’ set but not used [-Wunused-but-set-variable].

What makes these warnings? and how to avoid them?

  int CommandHandler(unsigned char cmd2send)
    {
        static unsigned char *cmd[65];

        // *make sure device is open*
        if(handle==NULL) // handle defined in transceiver.h
        {
            puts("CommandHandler::Cant handle command");
            // try to open device again
            if(OpenMyDev()!=0)
            return -1;
            // if no return then retry is fine
            puts("retry SUCCEEDED!, device is open");
        }

        // *send command to firmware*
        cmd[0]=0x0;
        cmd[1]=cmd2send;
        .......
        return 0;

    }

Here, also I’m getting warning #2 for variable voltage:

float Get_Temperature(void)
{
    //unsigned char RecvByte=0;
    //int byte[4];

    int i;

    float voltage=0;
    float resistance=0;
    float temperature=0;
    float SamplesAVG=0;

    unsigned int Samples=0;

    unsigned char* rvc;
    unsigned char mydata[65];


    for(i=0;i<=10;i++)
    {
        //Transimit Start Of Frame
        mydata[0]=0;
        mydata[1]=GET_TEMPERATURE;

        if(Write2MyDev(mydata)<0)  {return -1;}

        rvc=ReadMyDev(0);

        SamplesAVG+=(rvc[0]<<24)+(rvc[1]<<16)+(rvc[2]<<8)+rvc[3];
        usleep(100*1000);
    }

    Samples=SamplesAVG/10;
    printf("TO PRINT VAL:%d\n",Samples);
    puts("------------");

    voltage = (Samples * 5.0)/1023.0; // 0..1203= 1024 values
    resistance = 10000.0/ (1023.0/Samples);
    ...
    return retval;
}
  • 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-01T13:44:21+00:00Added an answer on June 1, 2026 at 1:44 pm

    cmd2send is an unsigned char and you are setting the value at cmd[1] which is a char * to it. A char * is a pointer and an unsigned char is treated like an integer so you are making a pointer cmd[1] from an integer without a cast.

    Chances are you wanted an array of characters char cmd[65] not an array of char *

    Also since you created and assigned values to cmd but you never use it you get a warning for that as well.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:

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.