Let’s say I have 2 functions:
void function1(int *ptr) {
printf("%d", *ptr);
}
and
void function2(char *str) {
printf("%s", str);
}
Why does function2 work, when there is no deference operator before str? In str there is only the address where it points to not the value as I thought.
Because
%s, as defined by the standard, expects achar *, i.e. an address.