Hello, I am a fresh newbie of C programming and I am having some trouble with a problem.
When you execute this it prints it as: (assuming you use 'Name' as the first name and Lastname as the last name)
Name LastName
4 8
The counts need to be aligned with the beginning of each name. The 4 under N and the 8 under the L.
This is what I came up thus far.
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(){
char Name[10];
char LastName[10];
printf("What is your first name?: ");
scanf("%s", Name);
printf("What is your last name?: ");
scanf("%s", LastName);
printf("%s %s\n %d %d ", Name, LastName,
strlen(Name), strlen(LastName), sizeof Name, sizeof LastName);
return 0;
}
Any sort of feedback is welcomed.