0
Next guys, I’m studying and I’m Beginner, and I have this resolution to solve and I’m having a hard time... I have to use scanf("%[^\n]%*c", s)
, where s
is an array of char
...
The code must read two terminal data, a character set (up to 100 characters) and an integer value and display them in the console.
#include <stdio.h>
#include <stdlib.h>
int main()
{
char s[100];
printf("Nome\n");
printf("3");
scanf("%[^\n]%*c", s);
return 0;
}
The code is like the one I put in, I got him to read the data, in case nome
and 3
by default, why the user does not need to type, plus the part of the scanf
I can’t.
The data entry has to be typed in the same code ta alie above, because the parts of the printf ta right.
name
3
Output expected one below the other so but the exit does not automatic that...
name
3
int main() { char s[100]; printf("name n"); printf("3"); scanf(" %[ n]", s); Return 0; } is type so bro, only I don’t know how to display the same value later with scanf
– Lucas pereira