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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:05:46+00:00 2026-05-25T18:05:46+00:00

The second arg in the prototypes for memmove/memcpy/strcpy are similar: For example: void *memmove(void

  • 0

The second arg in the prototypes for memmove/memcpy/strcpy are similar:
For example:

void *memmove(void *dest, const void *src, size_t n); //const void*
char *strcpy(char *dest, const char *src); //const char*

But apparently, if dest and src overlap, then src’s content will be altered, violating the const void/char *?

  • 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-25T18:05:46+00:00Added an answer on May 25, 2026 at 6:05 pm

    const void* means that the referand will not be modified through that pointer.

    If there are other, non-const pointers to the same object (also known as “aliasing”), then of course it can still be modified through those. In the scenario you describe, that other pointer is dest.

    By the way, in the case of strcpy, behavior is undefined if the regions overlap, and in C99 the signature is char *strcpy(char * restrict s1, const char * restrict s2);. But for memmove, aliasing is OK. By giving it overlapping regions you’ve given it “permission” to modify the dest region, and it will do that.

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

Sidebar

Related Questions

C++0x shows an example of using std::forward : template<class T> void foo(T&& arg) {
I have a file with function prototypes like this: int func1(type1 arg, int x);
i have following code #include <stdlib.h> #include <stdio.h> int sorter( const void *first_arg,const void*
public class Test{ public static void main(String[] arg){ System.out.println(Alexander The Great); } } In
#include <stdlib.h> int int_sorter( const void *first_arg, const void *second_arg ) { int first
I have two Haskell functions, both of which seem very similar to me. But
public class Shared { public static void main(String arg[]) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException,
this program hangs after taking first argument:- #include <stdio.h> #include <conio.h> void ellip(char*,...); int
#include <stdio.h> #include <errno.h> #include <pthread.h> pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER; void *func(void *arg) {
I have a menu with two levels, the second level shown in the secondary

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.