I am working with some C example, and using function strcpy()
, but forgot to include <string.h>
, though I have included <stdio.h>
. To my surprise code ran successfully. Following is the code I am executing:
#include <stdio.h>
int main() {
char message[10];
int count, i;
strcpy(message, "Hello, world!");
printf("Repeat how many times? ");
scanf("%d", &count);
for(i=0; i < count; i++) {
printf("%3d - %s\n", i, message);
}
}
I am using gcc version 3.3.6 (Ubuntu 1:3.3.6 - 15ubuntu1)
I even have not received any compilation warnings.
Why my code is working without including <string.h>
?
Thanks in advance.