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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:04:46+00:00 2026-05-22T01:04:46+00:00

if I have in c++: char abc[4]; abc[0] = 0xC0; //11000000 in binary abc[1]

  • 0

if I have in c++:

char abc[4];

abc[0] = 0xC0; //11000000 in binary

abc[1] = 0x20; //00100000 in binary

abc[2] = 0x44; //01000100 in binary

abc[3] = 0x20; //00100000 in binary

So how this will be stored in memory –

11000000 00100000 01000100 00100000 or the reverse way ??
----------------------------------- 
   0th      1st     2nd      3rd

In Java I am creating Bitset abc = new Bitset(32);

So I need to store the same values in this(same order).This may be
modified later according to bit positions so have to be exact same way.

So abc[32] = 0xC0204420 will do? And if I want to store
the values in c++ way what to do??
If I am wrong then how to do this in Java…

  • 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-22T01:04:47+00:00Added an answer on May 22, 2026 at 1:04 am

    Endian is not an issue. If you use char[4] the lowest address 0 will be first, the highest 3 will be last, so you get in memory

    char[0] char[1] char[2] char[3]
    

    whatever you do.

    If you do a int x = *(reinterpret_cast<int*>(abc)), then you get different results, depending on endianness, because the (4byte-) int is sometimes read as 0123, sometimes 3210 — and I think even 2301 has been around in the 60s.

    You can not put 0xC0204420 (a larger number then 127) into the [32]ths position of abc. If you want to implement something “fast” (and dangerous) you would need a platform-depending reinterpret_cast. Take a look at hton and ntoh.

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

Sidebar

Related Questions

I have this multi-dimensional array: char marr[][3] = {{abc},{def}}; Now if we encounter the
I have one requirement in C. char abc[]=hello; char hello[]=world; Using abc whether we
I have the following old c code. const char *c[3]; c[0] = ABC; c[1]
Hey. I have some problems writing char to a file with ofstream. this is
The code below will count the occurences of every character. If i have abc
I have: char *str = abc def abcdef ghi xyz; I want to assign
I have a column in a oracle table Lic_num char(7 byte) SELECT column1, 'ABC'
suppose i have in my code written following :- char *abc = Who cares;
Lets say we have an array of char pointers char* array[] = { abc,
Say if you have a char(5) column in the db and you have ABC

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.