i was reading the tutorials on this website and got to strcpy. this is what it says(with my concern underlined)what i understand from this is that strcpy will return 0. well i tried it out with printf and it gave me <dest>. am i understanding the tutorial wrong? or do i understand the term "return" wrong? doesn't 5 * 6 return 30(as an example)? heres my src anywayQuote:
strcpy is short for string copy, which means it copies the entire contents of src into dest. The contents of dest after strcpy will be exactly the same as src such that strcmp ( dest, src ) will return 0.
Code:#include <stdio.h>
#include <string.h>
int main() {
int i;
char string1[256], string2[256];
printf("Enter first string: ");
fgets(string1, 256, stdin);
printf("Enter second string: ");
fgets(string2, 256, stdin);
for(i = 0; i < 256; i++) {
if(string1[i] == '\n') string1[i] = '\0';
if(string2[i] == '\n') string2[i] = '\0';
}
printf("%s", strcpy(string1, string2));
getchar();
return 0;
}