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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:46:39+00:00 2026-06-04T07:46:39+00:00

Reader, Could anyone explain to me what will happen in my computer when I

  • 0

Reader,

Could anyone explain to me what will happen in my computer when I run this piece of false code.
Compiled with the gnu gcc compiler. in Codeblocks.

This is false code:

  char data[5];

  data[0] = '1';
  data[1] = '10';
  data[2] = '30';
  data[3] = '50';

  if(sizeof(data) == 5)
  {
  adjust(data);
  }

sizeof(data) is 5 because I declared char data[5].

If I try to read data[1] I noticed it will return the last char. Either ‘0’ or ’48’.

So I was wondering, what happens with the ‘1’ in data[1] and what will happen to my memory?

  • 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-04T07:46:40+00:00Added an answer on June 4, 2026 at 7:46 am

    It’s a bit confusing that you’re using multi-character literals like 10, that probably adds to your confusion. What will happen with a line like this:

    data[1] = '10';
    

    is:

    • The int-type (not char, in C) value '10' will be truncated down to char
    • The resulting value will be assigned to data[1].

    Which value this is, exactly, is compiler-dependent since the literal is larger than what fits in a single char.

    If you’re seeing 0 (numerically 48 on ASCII systems), this means that 10 was truncated to 0, which is the value stored. The 1 was then completely lost (not stored in an adjacent slot of the array, which you might have expected).

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

Sidebar

Related Questions

Could anyone explain what node means in MySQL? This one is talking about nested
I grabbed this compact news reader from here Below is the code for animating
Can anyone help me debug this program? The following is server code : package
Has anyone done something like this? How? I'm just starting a project that will
I would be very grateful if anyone could help me out with this problem.
Could anyone explain how HierarchicalDataTemplate works What Controls supports HierarchicalDataTemplate? What does a control
I wrote this code app = Tk() app.title('Myapp') app.geometry('260x100+50+50') labelText =StringVar() labelText.set('Insert the version
i have this code in one of my asp.net mvc views: <%Html.RenderFile(@C:\Members\newsletters\welcome.html);%> I have
After compile and run it shows no pdf printer available, How to solve this?
I am currently using the below code for printing a pdf using Foxit Reader

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.