This is the code that I want to run in C.
#include<stdio.h>
#include<string.h>
main()
{
struct record {
char name[2];
char letter;
};
struct record student[10];
strcpy(student[0].name,"t");//copy "t" to first struct's name variable
strcpy(student[1].name,"ri");//copy "ri" to second struct's name variable
student[0].letter='a';//copy "a" to first struct's letter variable
student[1].letter='b';//copy "b" to second struct's letter variable
printf("%s %s %c %c", student[0].name, student[1].name, student[0].letter, student[1].letter);
}
The output that I am expecting is: t ri a b
However I am getting: t rib a b
What is it that I am doing wrong?