printf in C--Zeiger-variable %p %c %s

void say(char msg[])
{   //using pointer to print out the first char of string
    printf("%c\n", *msg);
}

void say(char msg[])
{   //using pointer to print out the memory address of the         first char of string
    printf("%p\n", msg);
}

void say(char msg[])
{   //using pointer to print out the whole string
    printf("%s\n", msg);
}

Den ersten beiden Sinn machen, aber ich verstehe nicht ganz, wie die Dritte Funktion funktioniert. Alles was ich weiß ist, dass die msg-Punkte auf die Speicheradresse des ersten Zeichens der Zeichenfolge. Vielen Dank im Voraus.

InformationsquelleAutor user1164937 | 2012-06-27
Schreibe einen Kommentar