right. the size should be the length plus 1 yes?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;
}
this is the outputsize should be 10 surely. its like its calculating the sizeof string before it is changed by strcpy but the length after.Quote:
Originally Posted by command prompt
Is there something wrong with my syntax or what?
thanks
