Question: In C, Complete addUser1, which adds a new user by given the username, password and admin. This function also updates the userCount. #include #include #include
In C, Complete addUser1, which adds a new user by given the username, password and admin. This function also updates the userCount.
#include
struct user { char username [50]; char password [50]; int admin; };
void addUser1 ( struct user * users , char * username , char * password ,int admin , int * count ) {
// 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
Get step-by-step solutions from verified subject matter experts
