1
Reply

i have problem on my code

Hamied Amr

Hamied Amr

Mar 3 2017 3:52 PM
247
hey guys when i try to run that code the statement scanf("%c",&checker) the compiler skip it 
 
#include<stdio.h>
#include<string.h>
#include<conio.h>
int main(void){
char emp_first_name[10][10];
char emp_second_name[10][10];
char emp_name[10][50];
int days[10];
int years[10];
int months[10];
float salaries[10];
int i = 0;
char checker;
do
{
printf("Please enter employee first name\n");
scanf("%s",emp_first_name[i]);
printf("Please enter emplyee second name\n");
scanf("%s",emp_second_name[i]);
strcpy(emp_name[i],emp_first_name[i]);
strcat(emp_name[i]," ");
strcat(emp_name[i],emp_second_name[i]);
printf("Do u want to add another one press y if not press n\n");
scanf("%c",&checker);
i++;
} while (checker == 'y');
for (int j = 0; j < 10; j++)
{
printf("%s\n",emp_name[j]);
}
// scanf("%c",&checker);
return 0;
}

Answers (1)