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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:43:17+00:00 2026-06-13T13:43:17+00:00

Hello I have small problem with followed C code: //Hardcoded commands: #define someCommand 0x1223;

  • 0

Hello I have small problem with followed C code:

 //Hardcoded commands:

 #define someCommand 0x1223;
 #(...)

 //functions definitions:
 void socketWrite(uint8_t address, const uint8_t *data, size_t length);

 //main task
 int main(){

 //I want send someCommand to socket
 socketWrite(0xff, &someCommand, 1);

 (...)
 }

this code give me of course compilation error:
error: ‘someCommand’ was not declared in this scope

but my question is about how write this correctly without creating new buffer data that can handle this command like this:

uint8_t * buff;
*buff = someCommand;
socketWrite(0xff, buff, 1);
  • 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-13T13:43:19+00:00Added an answer on June 13, 2026 at 1:43 pm

    someCommand is a #define. The C preprocessor generates a source text by replacing it by its value.
    So your code looks like:

    socketWrite( 0xff, &0x1223, 1 );
    

    Taking address of 0x1223 isn’t possible.

    int value = someCommand;
    socketWrite( 0xff, &value, 1 );
    

    may works

    otherwise:

    const int someCommand = 0x1223;
    

    and later

    socketWrite(0xff, &someCommand, 1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello fellow stackies, I'm developing a site and I have a small problem. It's
Hello i am working about a articles script i have a small problem in
i have a small problem in my code when i try to update the
I have a small problem in my code. I have the following code: import
Hello guys i have a small problem at my console application i have a
Hello to all that read I have a small problem(or it could be large!),
I have a problem with the MASM32 assembler The following code is a Hello
hello I have a small question in objective-C memory management. I know that if
hello all I have a small dialog which I created dynamically, which has a
I have written a small program just like hello the world , everything was

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.