So i need to allow the user to input numbers of a matrix one line at a time, and if they input $ it means the matrix is completed and they want to move on, so i wrote this but having to look if the user has inputed $ using getchar() eats the first digit of each number. Is there a way for getchar to not erase the character it gets from the buffer? i also take other suggestions, thanks.
Code:
for (int dato = 0; dato < 400; dato++) {
scanf("%i", &Matriz1[fila][dato]);
if (getchar() == '\n') {
fila++;
}
if (getchar() == '$') {
break;
}
}