3

The width of your image is 3. When you use that minus sign here fseek(inptr, -bi.biWidth * sizeof(RGBTRIPLE), SEEK_CUR); , it becomes -3. But before the multiplication takes place, C rules of arithmetic conversion (read more about it here) will force your signed -3 to become an unsigned number to match the unsigned status of the second factor of the ...


2

About the overflow, read this: Error in my pset4 resize.c code Apart from that, what's happening is that you're copying the headers to bi and bf, but you're not copying those headers also to bfNew and biNew, so you're left with lots of garbage values, since you only alter some of them in bfNew and biNew and leave the others untouched, thus uninitialized. ...


1

Why are you using modulo for this? It produces an unreliable result in this usage. Further, the actual numbers don't make sense. The modulo function returns the remainder after an integer division. So, for example, say that you're doing while (cents % 10 == 5) If cents were $1.05, it would be true, but if cents were $1.06, it would be false. In both ...


1

I assume the % strlen(key) is causing some type conversion. Your logic is wrong. First iterate the key to ensure all characters are alphabetic, and maybe also uppercase the key there if you want. Then, after the first loop, iterate the plaintext, keeping a separate index for the key that you increment on encrypting a letter only. Separate loops. toupper(key[...


Only top voted, non community-wiki answers of a minimum length are eligible