7 Topics

Member Avatar for
Member Avatar for N1GHTS

Say I have code like this... typedef struct { unsigned A:1; unsigned B:1; } FlagStruct; extern FlagStruct *Flags; Imagine that the Flags instance is a shared resource in a multi-threaded application. Say thread #1 decides to read the value of Flags->A but thread #2 decides to set or clear Flag->B …

Member Avatar for N1GHTS
0
238
Member Avatar for Raquel_2

// random number generator var theDecimal = 0; function newProblem(){ theDecimal = Math.floor(Math.random()*256); //math.floor chops off decimals and rounds document.getElementById("startNumber").innerHTML = theDecimal; }

Member Avatar for Schol-R-LEA
0
252
Member Avatar for Alexkid

Hi there, I have an array of unsigned chars SOURCE, i need to combine into DESTINATION, i want to turn: SOURCE[0] = 3 SOURCE[1] = 9 SOURCE[2] = ' ' SOURCE[3] = 0 SOURCE[4] = 4 SOURCE[5] = ' ' SOURCE[6] = 7 SOURCE[7] = d into DESTINATION[0] = 39 …

Member Avatar for deceptikon
0
4K
Member Avatar for kruschev

void Project1(){ unsigned short int x; bool flag = false; cout << "Enter an interger, I will reversed i.e. 301 --> 103" << endl; cin >> x; if ((x > 0) && (x <= 65535) ){ flag == true; cout << reverse_num(x); cout << endl; } else { cout << …

Member Avatar for nullptr
0
272
Member Avatar for jen140

Hello. I've been doing a small application that will go (using only unsigned integer values) from 0 to 4026531840 and print them out. My code is next: [CODE]#include <stdio.h> #include <inttypes.h> int main(void){ uint64_t cnt; for(cnt=0;cnt<=4026531840;cnt++){ printf("%d\n",cnt); } } [/CODE] The only problem that i have is the last numbers …

Member Avatar for jen140
0
185
Member Avatar for vincenzorm117

Before you read, I am using Mac's Xcode. In this program I am attempting to print the maximum and minimum values of standard C variables with every variation of modifiers. The unsigned int uses 4 bytes therefore it must have a maximum value of 4294967296 but it only display 2147483647 …

Member Avatar for vincenzorm117
0
614
Member Avatar for Labdabeta

This is a conversion question that has me stumped. I need to convert an unsigned char to a signed float. Some examples: 0xFF becomes 1.0f 0x00 becomes -1.0f 0x80 becomes ~0.0f The only idea that I could come up with was a massive switch statement. But a switch statement will …

Member Avatar for ddanbe
0
336

The End.