Question
In C, Complete addUser2, which adds a new user by given a struct user. This function also updates the userCount. Complete printUser #include #include #include
In C, Complete addUser2, which adds a new user by given a struct user. This function also updates the userCount. Complete printUser
#include
struct user { char username [50]; char password [50]; int admin; };
void addUser2 ( struct user * users , struct user * newUser , int * count ) {
//CODE GOES HERE }
void printUser ( struct user * users , int max_number_of_users ) {
//CODE GOES HERE }
int main ( void ) { struct user * users = createUsers (10); if ( users == NULL ) { return 0; }
int userCount = 0; initUsers ( users , 10); addUser1 ( users , " admin " , " s #1 Pa5 " , 1 , & userCount ); addUser1 ( users , " vahab " , " fgH !12" , 0 , & userCount ); struct user u1 ; u1.admin = 2; strcpy ( u1 . username , " usf "); strcpy ( u1 . password , " gA24 ? m "); addUser2 ( users , u1 , & userCount ); printUser ( users , userCount ); free ( users ); return 0; }
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