Write a c program that creates a union named users with two


Please help!!!

1. Write a C program that creates a structure named student with three members (name, last name and id).
Enter 2 student's information and save it in a txt file.

2. Write a C program that creates a union named "users" with two members (last name and email).
Enter 3 users's information, print it (make sure you print the correct values) and save the correct values in a txt file.

3. What is wrong or missing in this code to avoid errors or warnings?

#include
#include
void main() {
union details {
struct student st;
};
union details set;
printf("Enter details:");
printf("\nEnter FIrst name : ");
scanf("%s", set.st.first_name);
printf("\nEnter id : ");
scanf("%d", &set.st.id);

printf("\nFirst name : %s", set.st.first_name);
printf("\nId : %d", set.st.id);
getch();
}

4. What is wrong or missing in this code to avoid errors or warnings?

#include
int main() {
char buff[255];

fp = fopen("C:\\temp\\test1.txt", "r");
fscanf(fp, "%s", buff);
printf("1 : %s\n", buff );

fgets(buff, 255, (FILE*) );
printf("2: %s\n", buff );

return 0;

}

5. Write a program to insert the binary sequence [1 0 0 0 1 0 1 1] in a register named "my_register" using bit fields."

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Write a c program that creates a union named users with two
Reference No:- TGS02889168

Expected delivery within 24 Hours