#Meta-Wlp: #Macro: TITLE wlp: Learn C (III) p. 4 #Eval: $TITLE$ #Macro: PAGE bb3-4

That was a tricky question.

The variables s and t are char-stars, but they are also strings. A string is a special type of char-star.

The string s acts as a format string in the printf. The string s contains the %s marker, which directs printf to look for a string variable among the arguments following the format string, and to substitute it in at that point. The string variable after the format string, which is substituted in at th %s, is the variable t.

#include<stdio.h>

int main(){
  char * s ;         /* one char-star */
  char * t ;         /* another char-star */

  /* initialize the char-star's */
  s = "I am a string - " ;
  t = "but what am I?" ;

  printf(s) ;
  printf ("%s\n",t) ;

}
Is this another way to get exactly the same output? #Shuffle: none $PAGE$-A $PAGE$-B Return to Learn C Table of Contents #: No, it is different. #: Yes, it is the same. #: