Whatrf is a "const void *src"

Todd Chester 711 Reputation points
2022-11-30T23:38:36.683+00:00

In the following:

https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/memcpy-s-wmemcpy-s?view=msvc-170
C
errno_t memcpy_s(
void *dest,
size_t destSize,
const void *src,
size_t count
);

What exactly is a "const void *src"?

Developer technologies | C++
Developer technologies | C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Minxin Yu 13,511 Reputation points Microsoft External Staff
    2022-12-01T02:13:25.08+00:00

    Hi, @Todd Chester

    const void *src

    You need to split it into two parts

    1. Pointer to Constant

    The address of pointers can be changed, but the value of the variable that the pointer points cannot be changed.

    E.g. const int* ptr;

    2 .void pointer

    A void* pointer can be converted into any other type of data pointer.

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.