Learning by doing: Reading books and trying to understand the (code) examples
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
327 B

  1. #include <stdio.h>
  2. #include <string.h>
  3. int main (void) {
  4. char first_name[20];
  5. printf("Your first name: ");
  6. scanf("%s", first_name);
  7. printf("Your name: \"%s\"\n", first_name);
  8. printf("Your name: \"%20s\"\n", first_name);
  9. printf("Your name: \"%*s\"\n", (int)(strlen(first_name)+3), first_name);
  10. return 0;
  11. }