%u, very helpful, thanks.
Type: Posts; User: enkwiringmindz
%u, very helpful, thanks.
OK I think I see that C does not allow unsigned integers of this magnitude, but the bit representation is still all ones, correct? That's all that really matters to me.
Yea it makes sense to me for signed integers, but for unsigned integers I am not clear why this is also the case. Guess I should brush up on two's complement.
Even with unsigned integers?
How come performing the unary NOT (~) opertion on int x = 0 gives the value of -1 and not a saturated int value?
OK I see, thanks a lot for your help.
I should have mentioned the return value is actually a char not int, it should still return 255 though right?
Can someone explain to me how come these two operations yield different return values, using x=200, y=100?
// this returns 200
((x + y) > 255) ? (255) : (x + y);
// this returns 255...
OK I got it, appreciate your help.
I need to convert a char* to a unsigned int* for input into an RC5 encryption algorhythm method. The program ends up crashing when trying to use the converted type. How can this conversion be made...
The min-max algorithm can be used for this. Research min-max algorithm, and I think once you understand the algorithm, it is easy to program.
I have this code in a web service, but when I try to update the database using the second method (setContacts), it does not update at all, although I do not get an error message.
[WebMethod] ...
Good explanation. Thanks for the help guys.
Haha, of course, that works, thanks...thought fread was void type.
my problem
input = malloc(512);
fread(input,1,512,file);
printf("%d\n", strlen(input));
printf("%s\n", input);
fclose(file);
I read the text using fread(input,1,512,file). It is odd though that if I use "aaaaaaaaa", the input is equal to "aaaaaaaastem;C:\program files..."???? It works fine with some input like "aaaaa"
OK I see when I print, it looks like notepad appends some random character to the end of the file. Any idea what is going on with that character? Thank you so much for helping.
Please help me understand. I read a char*input from a text file with "aa" as text. If each char is 8 bytes, how can it be that strlen(input) is not equal to 16, but 5? Thanks.
OK I see. Thanks a lot.
How come you do not have to use the dereference operator when printing the string my_string in the following code?
char *my_string = malloc(sizeof(*my_string)*100);
printf("Enter a...