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.
 
 
 
 
 

22 lines
567 B

#include <stdio.h>
#include <string.h>
int main (void) {
char first_name[21];
char last_name[21];
printf("Give your first name: ");
scanf("%20s", first_name);
printf("Give your last name: ");
scanf("%20s", last_name);
printf("%s %s\n", first_name, last_name);
printf("%*lu %*lu\n", (int)strlen(first_name), strlen(first_name), (int)strlen(last_name), strlen(last_name));
printf("%s %s\n", first_name, last_name);
printf("%-*lu %-*lu\n", (int)strlen(first_name), strlen(first_name), (int)strlen(last_name), strlen(last_name));
return 0;
}