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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:02:56+00:00 2026-05-23T23:02:56+00:00

I have the following code that calls the function uint32_pack. This program compiles with

  • 0

I have the following code that calls the function uint32_pack. This program compiles with no errors in Dev-C++ but does not produce the correct result when ‘tag’ is an even number. In Visual Studio the program compiles but produces errors and I’m guessing that these errors are why I don’t get the correct output when ‘tag’ is even. I’m still trying to get my head around pointers and I’m not sure where I went wrong when declaring them. Thanks for your help.

Here is the code where the errors come from:

 1  int uint32_pack (uint8_t *fieldnumber, uint32_t value, uint8_t *out);
 2  int main(){
 3  uint32_t initvalue = 2;
 4  int return_rv;  
 5  uint8_t *tag = (uint8_t *) malloc(sizeof(uint8_t));
 6  *tag = 38;
 7  uint8_t *tempout= (uint8_t *) malloc(30);
 8  return_rv = uint32_pack (tag, initvalue, tempout);
 9  free(tempout);
10  free(tag);
11  }

And the errors from VS as are follows:

error C2143: syntax error : missing ';' before 'type' (on line 7)
error C2065: 'tempout' : undeclared identifier        (on line 8)
warning C4047: 'function' : 'unsigned char *' differs in levels of indirection from 'int' (on line 8)
warning C4024: 'uint32_pack' : different types for formal and actual parameter 3 (on line 8) 
error C2065: 'tempout' : undeclared identifier  (on line 9)
warning C4022: 'free' : pointer mismatch for actual parameter 1 (on line 9)
  • 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-23T23:02:59+00:00Added an answer on May 23, 2026 at 11:02 pm

    The last three errors are consequences of the second, and the second is a consequence of the first. That only leaves the first and third unexplained.

    The first error occurs because you are using C89 and not C++ or C99; you cannot declare variables after code in C89.

    Reverse the order of lines 6 and 7 and you should probably be OK. (I think the third error is also a consequence of the first, too, but that is not definitive.)

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

Sidebar

Related Questions

I have something like the following code in one of my views: <?php $this->load->view('_validation_error',
I have a method that calls another method of a mocked object with a
I have been looking for a design that solves the following problem. It will
In a simulation I'm writing I have a class that represents an Agent that
I'm working with some web services that have already been created and I need
I have 2 libraries. Library A is compiled in C. Library B is compiled
I'm trying to do some CoreGraphics/CoreImage manipulation inside an NSOperation, using MacRuby. I have
I was wondering if there is any way (standard or a clever trick) to
I'm pretty new to jQuery and javaScript programming and wondered if anyone could help
I am writing a url shortener app and I would like to also create

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.