Hi, I am a novice in C Programming. And I have some problem regarding to using while or do while loop to quit when user enter "STOP". I have a case statement which will execute this. And I wanted to quit user input when "done" is entered by the user. The following is my code: case 2: printf("Enter name and their id"); while (strcmp(name,"stop")!=0) { scanf("%s %d",name,&id); /*create customer record function here so after every scan, i will pass in the parameters name and id*/ } break; I will appreciate any help and thank you!:nice:
Code: char name[100] = {'\0'}; int id = -1; do { printf("Enter name -> "); scanf("%s", &name); printf("Enter id - > "); scanf("%d", &id); }while(strcmp(name, "stop") == 0);