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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:33:13+00:00 2026-06-14T04:33:13+00:00

Sorry to ask this but I have searched for this small thing and found

  • 0

Sorry to ask this but I have searched for this small thing and found somthing related on this below link but was unable get any idea

  1. How to store floats in array to be used later?

  2. storing in unsigned char array

How to store a float value suppose 0.00895 to an unsigned char which is later used to store in the memory buffer.

And later I need to read the array back and want to read it back from the memory.

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-14T04:33:15+00:00Added an answer on June 14, 2026 at 4:33 am

    You don’t need memcpy for this… That would be useful if you were copying a float array into a buffer elsewhere in memory. All you really need is to use a different pointer type to look into the character array.

    const size_t BUFSIZE = 4096;
    char buffer[BUFSIZE];
    float *f_buf = (float*)buffer;
    

    If all you wanted was to stick a single float into the start of the buffer, either of the following two lines is okay:

    *f_buf = 0.00895;
    
    f_buf[0] = 0.00895;
    

    All it’s really doing is letting you see the buffer as an array of floats.

    int i;
    
    /* Put a bunch of floats into the buffer */
    for( i = 0; i < 10; i++ ) {
        f_buf[i] = i / 2;
    }
    
    /* Display contents of buffer in hex */
    for( i = 0; i < 10 * sizeof(float); i++ ) {
        printf( "%02x", (int)buffer[i] );
    }
    printf( "\n" );
    
    /* Sanity-test the buffer contents */
    for( i = 0; i < 10; i++ ) {
        printf( "%d: %f\n", i, f_buf[i] );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sorry to ask this question but I have spent hours trying to understand
I'm really sorry to have to ask this, but I clearly don't understand something
Sorry to have to ask yet another position:fixed related question, but reading through various
hi guys sorry to ask this one again but i have some jquery that
I'm sorry to have to ask something like this but python's mechanize documentation seems
Sorry to ask this question again but I tried several solutions on stackoverflow and
Sorry to ask this, but with previouse reading, re-reading of doc and all the
Sorry but I am not sure how to ask this question but I am
(I am sorry, I wanted to ask this question on meta first, but it
Sorry, this's my first time to ask a question here. So, I don't have

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.