#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void main()
{
    unsigned char str[] = "abcdefg";
    unsigned char *str1 = (unsigned char*)malloc(sizeof(str) -1);
    memcpy(str1, str, (sizeof(str)-1) );
    for(int i = 0; i<(sizeof(str1)); i++)
        printf("%c", str1[i]);
    free(str1);
}
I want copy the string str to str1 but the output is 
abcd
It means that only pointer byte(4byte) is copied.
And i try
printf("%d", sizeof(str)-1 );
it's output is 7
What is my mistake?
 
     
     
    