Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using online GDB , please extend the C code below, and show a screenshot of the output! The code should simulate and print user login
Using online GDBplease extend the C code below, and show a screenshot of the output!
The code should simulate and print user login records so that the information about the user's terminal is also stored in the file and then printed. Your program output should look like this:
user last logged in on terminal on Mon Jun ::
user last logged in on terminal on Mon Jun ::
user last logged in on terminal on Mon Jun ::
Submit a single C source code file with your work and a screenshot in PNG or JPG format showing the results of executing your program.
The Code:
using structures in C
#include
#include
struct dataRecord a simple structure to represent a person
int intID;
int intAge;
float fSalary;
char strName;
;
print the values of a structure
void printDataRecordconst struct dataRecord p
printfs is d years of age, their salary is f
pstrName, pintAge, pfSalary;
int main
struct dataRecord John; declare an instance of a structure
John.intID;
John.intAge;
John.fSalary;
strcpyJohnstrName,"John";
printDataRecord&John;
John.intAge; change one field within a structure
struct dataRecord alias;
alias&John; create a pointer to a structure
aliasfSalary; access a field within a structure via a pointer
printDataRecord&John;
aliasfSalary;
printDataRecordalias;
return
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started