How to write a C Program in Structure with Multiple Variables in C programming ?
Solution:
#include <stdio.h>
struct new_struct
{
int i;
char ch;
double d;
char str[80];
};
int main()
{
new_struct s;
printf("Enter an integer: ");
scanf("%d",&s.i);
printf("Enter a double: ");
scanf("%lf",&s.d);
getchar();
printf("Enter a character: ");
s.ch = getchar();
getchar();
printf("Enter a string: ");
gets(s.str);
printf("%d %f %c %s",s.i,s.d,s.ch,s.str);
}