I have to write a program using the scanf and the gets methods, I tried with this code:
#include <stdio.h>
#include <string.h>
int main() {
    char string[50];
    printf("first string (printf and scanf):\t");
    scanf("%s", &string);
    printf("%s", string);
    printf("\n\nsecond string (gets and puts):\t");
    gets(string);
    puts(string);
}
But gets() is receiving a \n as input, how can I fix it? I've already tried with a getchar() before this, but I don't know if it's correct.
