Both name and &name should give the same result. Strictly speaking, only name valid for the standard C language, and &name leads to undefined behavior, so you should definitely use name , but in practice both will work.
name is an array, so when you use it as an argument to a function (as you do when you pass it to printf ), it "splits" into a pointer to its original element (which is char* here).
&name gives you the address of the array; this address matches the address of the original element (because there should be no padding bytes in front of the original element of the array or between elements in the array), therefore &name and name have the same pointer value.
However, they have different types: &name is of type char (*)[30] (a pointer to an array of 30 char ), and name , when it decays to a pointer to its source element, is of type char* (a pointer to char , in this case is the initial char element of the name array).
Since they have the same meaning, and since the printf and scanf functions will in any case reinterpret the argument as char* , there should be no difference whether you pass name or &name .
source share