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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:14:48+00:00 2026-05-22T16:14:48+00:00

I discovered that the strcpy function simply copied one string to anther. For instance,

  • 0

I discovered that the strcpy function simply copied one string to anther. For instance, if a program included the following statements:

char buffer[10];
----------
strcpy(buffer, "Dante");

the string “Dante” would be placed in the array buffer[]. The string would include the terminating null(\0), which means that six characters in all would be copied. I’m just wondering why we can’t achieve the same effect more simply by saying?:

buffer = "Dante";

If I’m not mistaken, C treats strings far more like arrays than BASIC does.

  • 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-22T16:14:49+00:00Added an answer on May 22, 2026 at 4:14 pm

    Because strings aren’t a data type in C. “Strings” are char*s, so when you try to assign them, you are simply copying the memory address and not the characters into the buffer.

    Consider this:

    char* buffer;
    
    buffer = malloc(20);
    buffer = "Dante";
    

    Why should it magically place “Dante” into the buffer?

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

Sidebar

Related Questions

I've discovered that the following code: public static class MimeHelper { public static string
I discovered that one of the tables of a legacy db I'm working on
I've discovered that any time I do the following: echo '<a href=http:// title=bla>huzzah</a>'; I
I've just discovered that Oracle lets you do the following: SELECT foo.a, (SELECT c
recently I discovered that executing a C program as a release build instead of
I've recently discovered that MVC is supposed to have two different flavors, model one
I've discovered that setcookie() function escapes special characters, such as quotes. I've solved this
I discovered that the dojox.charting.action2d.Tooltip takes a custom function to provide the text for
I just discovered that one of my site was considered by Chrome as a
I have discovered that if i run following lines of code. int i =

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.