In this PROGRAM 1 i am not getting the expected output.
// PROGRAM 1
#include <stdio.h>
int main () {
char str1, str2;
printf("Enter char1: \n");
scanf("%c", str1);
printf("Enter char2: \n");
scanf("%c", str2);
printf("Entered char1: %c\n", str1);
printf("Entered char2:%c\n", str2);
return(0);
}
In this program i am getting expected output. So pls tell me the reason why not for PROGRAM 1
//PROGRAM 2
#include <stdio.h>
int main () {
char str1[5], str2[5];
printf("Enter name: \n");
scanf("%s", str1);
printf("Enter your website name: \n");
scanf("%s", str2);
printf("Entered Name: %s\n", str1);
printf("Entered Website:%s\n", str2);
return(0);
}