I am using the following code to read in the characters of a file and put them into an array. Thus, each array element contains a character from the file
But how do I just assign 31 bits of str as the address location and the MSB 1 bit as a flag bit?Code:unsigned char *str; str = (unsigned char*)malloc(filelength*sizeof(unsigned char)); fread(str, sizeof(unsigned char), filelength, file);
This flag bit is used to indicate if this array element is read before. If this array element is read before, then the flag bit is set to 1.
I think it is possible to assign an integer to every array element as the flag bit, but that will be a waste of space, using 1 byte as a flag bit.
Any suggestions or help! Thanks!