I'm having a problem with this program I don't understand the scanf("%[^\n]s",s);, because I don't understand what went wrong, the problem shown in the execution goes through the other scanef but when it gets to this one scanf("%[^\n]s",s);, skip and show the result. Where is the error?
another the program statement asks to use gets or getline but I couldn't use it.
scanf("%d", &numberInteger);
scanf("%f", &numberDouble);
scanf("%[^\n]s",s);
code:
int main() {
int i = 4;
double d = 4.0;
char s[] = "HackerRank ";
int numberInteger = 0;
float numberDouble = 0.0;
char ttt;
scanf("%d", &numberInteger);
scanf("%f", &numberDouble);
scanf("%[^\n]s",s);
//strcat(s, suruba);
printf("%d\n%.1f\n%s", i+numberInteger, numberDouble+d, &s);
return 0;
}