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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:07:56+00:00 2026-06-09T04:07:56+00:00

Now lets see this small program char s[20]=One; strcat(s,Two); cout<<s<<endl; Here at first s

  • 0

Now lets see this small program

char s[20]="One";
strcat(s,"Two");
cout<<s<<endl;

Here at first s has the value “One” and for visual representation this is the value of s:

O – n – e – \0

Then I add “Two” to the end of the string producing this:

O – n – e – T – w – o – \0

Now as you can see the only null in the string at first was after “One” now it is after “OneTwo”

My question is:
Is the null overwritten by the string “Two” and then it adds it’s own null at the end.

Or is the null that was already there in the beginning moved back to be at the end again?

(This question might seem not to make a difference but I like to know about everything I learn)

Thank you

  • 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-09T04:07:58+00:00Added an answer on June 9, 2026 at 4:07 am

    The first \0 is overwritten, and a new \0 is added at the end of the concatenated string. There is no scope for “moving” anything here. These are locations to which values get assigned.

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

Sidebar

Related Questions

I have a city table that has two columns from_city to_city now lets assume
Been using git for a few months now and this one has me stumped.
Here is one very simple question(or at least at first sight).Let's say we have
Here's my situation - lets see if any coding geniuses out there can help
ok, lets see if i can explain this. i have a List<Games> _Games =
lets say i have app id, app secret id and user uid now i
I have an array lets say a = { 1,4,5,6,2,23,4,2}; now I have to
lets say we have a link <a href=/something target=_new>blah</a> and now i want a
Let's say I have created two objects from class foo and now want to
Ok, let's see if this all makes sense. Today, as I began working on

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.