Ampersand or no ampersand before string variable name in scanf() and printf()?

Viewed 830

The compiler I'm using is Dev C++ 5.11. TDM-GCC 4.9.2 32-bit Debug. C99 mode.

1.

 char str1[100], str2[100];
 scanf("%s %s", &str1, &str2);
 printf("%s %s", &str1, &str2);

2.

 char str1[100], str2[100];
 scanf("%s %s", &str1, &str2);
 printf("%s %s", str1, str2);

3.

 char str1[100], str2[100];
 scanf("%s %s", str1, str2);
 printf("%s %s", str1, str2);

Every code works. Why? I'm very confused.

4 Answers
Related