0
I dont know how but i need to prompt to input 2 seperate characters and output that 2 characters but it doesnt work..
getc or getchar https://code.sololearn.com/cI0OQhAFkqXH/?ref=app
8 Réponses
+ 2
Call getchar() once again after reading value for <a>, but without assigning its return value to anything. This extra call is meant to consume the line break '\n' character that was read following input for <a>.
+ 2
char a = getchar();
getchar();
// call getchar() again to consume the line break character that came from pressing {Enter} key or whitespace from {Spacebar}
char b = getchar();
+ 1
Are you needing to output as such
Input
chat a = 'a';
char b = 'b';
Output:
ab
Or
a
b
and are they to be printed or returned?
+ 1
I dont get what you mean ipang.. Sorry
+ 1
#include <stdio.h>
int main(void){
char a, b;
a = getc(stdin);
b = getc(stdin);
printf("%c%c", a,b);
}
add in any printf messages you want.
+ 1
Thanks guys for the help.. Im good now
0
Yeah i need to input 2 different chars and output that 2 characters that is inputted
0
How can i do project for the fourth trial and make it do completed