I'm writing simple program in C and got stucked. I have three functions:
void changeStatusOfBook(User users[], Book books[]) {
char *id= askForBookID();
Book book = getBookById(books, id);
.
.
.
}
char * askForBookID() {
char id[6];
printf("Tell me which book (ID)\n");
scanf_s("%5s",id, 6);
return id;
}
Book getBookById(Book books[], char bookID[]) {
int counter = 0;
//bookID becomes a trash here
.
.
.
}
The problem is: In the first function I get correct user string input, but when I pass it to third function I'm getting some trash in it. How to fix it?