Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the following program: #include <stdio.h> struct student { int id; char na

ID: 3826698 • Letter: G

Question

Given the following program:

#include <stdio.h> struct student
{

int id;
char name[20]; char grade;

};
void func(struct student stud); int main()
{

struct student astud; astud.id=9401; strcpy(astud.name, "Joe"); astud.grade = 'A'; func(astud);

return 0; }

Abdelghani Bellaachia, CSCI 1121 Page: 16 void func(struct student astud)
{

printf(" Id is: %d ", astud.id); printf(" Name is: %s ", astud.name); printf(" Grade is: %c ", astud.grade);

}

Modify this program to include the address of a student as a separate structure. The address should include the following:

Address as an array of 30 characters

City as a an array of 20 characters

Zipcode as an integer.

in C programin language

Explanation / Answer

#include <stdio.h>
#include <string.h>

struct addess
{
char addrs[30];
char city[30];
int zipcode;
};

struct student
{
int id;
char name[20];
char grade;
struct addess adrs;
};

void func(struct student stud);

int main()
{
struct student astud;
astud.id=9401;
strcpy(astud.name, "Joe");
astud.grade = 'A';
  
strcpy(astud.adrs.addrs, "address line");
strcpy(astud.adrs.city, "city");
astud.adrs.zipcode = 123456;
  
func(astud);
return 0;
}
//Abdelghani Bellaachia, CSCI 1121 Page: 16
void func(struct student astud)
{
printf(" Id is: %d ", astud.id);
printf(" Name is: %s ", astud.name);
printf(" Address is: %s ", astud.adrs.addrs);
printf(" City is: %s ", astud.adrs.city);
printf(" Zipcode is: %d ", astud.adrs.zipcode);
  
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote