Can anyone explain why I used 2 times scanf or 2 gets or gets then scanf works but if scanf then gets, it doesn't work thanks !!!
#include <stdio.h>
#include <string.h>
int main() {
    char firstname[100], lastname[100], name[100] = "";
    printf("first name: ");
    scanf("%s", firstname);
    printf("last name: ");
    gets(lastname);
    strcat(name, firstname);
    strcat(name, " ");
    strcat(name, lastname);
    printf("your name is ");
    puts(name);
}
