Characters entered for a user name and password

Asked By 0 points N/A Posted on -
qa-featured

How characters can be  entered on the maximum at any one time for a user name and password?

SHARE
Answered By 0 points N/A #116772

Characters entered for a user name and password

qa-featured

Use a String DataType. Then apply it on the username and password. Two variables shall hold the username and password. If you are in an environment, where there is no String datatype, then you need is a character array, but be sure to create the array using dynamic methods such as malloc(). This creates the array of size ten.

int *A = (int *) malloc ( sizeof (int) * 10);

the members of the array can be accessed as usual .

A[3]=45;

This is usual.

Next is that You need is an exception condition of array index out of bounds which occurs when a username is greater than the size of the array. There you need is realloc() to reallocate a new array of bigger size, keeping the previous info. of the array intact.

int *B = (int*) realloc ( A, sizeof(int) * 20 ); 

A=B;

This increases the array size to 20.

Then you need to get back to the previous program segment using Goto.

Thus you can get a huge size of username and password using the methodology.

However using String Variables is easier for coding but the internal implementations are similar.

Thanks.

Login/Register to Answer

Related Questions