Code:
#include <stdio.h>
#include<string.h>
main()
{
char string[] = "october";
strcpy(string, "september");
printf("the size of %s is %d and the length is %d\n\n", string, sizeof(string), strlen(string));
return 0;
}
right. the size should be the length plus 1 yes?
this is the output

Originally Posted by
command prompt
the size of september is 8 and the length is 9
Press any key to continue
size should be 10 surely. its like its calculating the sizeof string before it is changed by strcpy but the length after.
Is there something wrong with my syntax or what?
thanks