The problem is that it is reading the newline with the second call to scanf(). Rememeber when you hit enter the '\n' character is put into the input stream. So say for the first scanf() you enter 'a' then press enter('\n') the '\n' is still in the input stream. So now the second scanf() immediately picks this up and does not give you a chance to enter your second character. A quick fix is to do something like....
Code:
#include <stdio.h>
int main(void)
{
char first;
char second;
printf("Enter a letter:");
scanf("%c", &first);
printf("Enter another letter:");
scanf(" %c", &second);
printf("%c %c", first,second);
}
Notice the extra spacing in the second scanf(), this will make it so it skips whitespace, and the newline character '\n' is considered just that.
About putchar(), getchar() and all that those are just other ways to work with input and output, and imo they are easier to work with than scanf().
putchar() takes an integer as it's arguement and prints it to stdout, which is the terminal usually. Remember that integers and characters are basically interchangeable. A character in C is considered to be a "small integer" because internally it is represented by a number. So you could do something like
Code:
/* print the letter k */
char letter = 'k';
putchar(k);
or...
/* print a newline, 10 is the decimal value for the newline character */
putchar(10);
Both are valid and work, just think of them as being basically interchangeable.
getchar() reads the next character from stdin and returns it. So you could do something like..
Code:
/* Get a character and print it */
int c;
c = getchar();
putchar(c);
Edit- woops just noticed, you were using void main() in your program hehe. Not good!
Use int main(void) instead.
Goodluck.