+ 2
Want to save and access the input function in C
I want to know how can i save the scanf data in C program and user it further in the same program
5 Answers
+ 3
Perhaps you may check:
https://www.sololearn.com/learn/1353/?ref=app
And also check out :
https://www.sololearn.com/learn/3023/?ref=app
The format specifiers in the above lesson work just in the same way for scanf, just that it requires a reference instead of the normal variable.
+ 2
i want to input the student name of 4 students and then get output of any one student name by inputing the student number
+ 2
If you want to get the student names then prompt the user once again to enter the student number, that would be impossible in Sololearn because of the fact that there is no live console.
What you could do instead is set a fifth input variable, this one as a number, and set it in a switch statement to test its value (here's a lesson on switch, if you need-https://www.sololearn.com/learn/3018/?ref=app).
+ 1
What you could do is set multiple different variables, all of them being an array of chars, and set the scanf function to scan for multiple different inputs, all being stored to a corresponding variable.
For example, if you wanted to scan for the name is 4 different students:
char s1[100];
char s2[100];
char s3[100];
char s4[100];
scanf("%s %s %s %s", &s1, &s2, &s3, &s4);
printf("%s %s %s %s", s1, s2, s3, s4);
+ 1
after I scanned 4 names....
I want a program which will display the name by typing the name number
i mean If i will type 3 it should tell me the number which i typed earlier in the 3rd number