Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
unsigned
- Page 1
Re: unsigned long % operation
Programming
Software Development
16 Years Ago
by Salem
….h> int main(void) {
unsigned
int nBolum = 0;
unsigned
long nKalan = 0L;
unsigned
long ulA = 2607503366UL;
unsigned
long ulB = 16777215UL; printf("ulA…); printf("ulB=%lu\n", ulB); nBolum = (
unsigned
int) ulA / ulB; nKalan = (
unsigned
long) (ulA % ulB); printf("nBolum = %u\n…
Re: unsigned long division operation
Programming
Software Development
16 Years Ago
by asilter
… to : */ /*
unsigned
int nBolum = 0; */
unsigned
long nKalan = 0L;
unsigned
long ulA = 0L;
unsigned
long ulB = 0L;…("ulB=%u\n",ulB); nBolum = (
unsigned
long) ulA/ulB; /* I have changed this line… to : */ /* nBolum = (
unsigned
int) ulA/ulB;*/ nKalan = (
unsigned
long) ulA%ulB; printf("nBolum = …
Re: unsigned and signed mix operation
Programming
Software Development
14 Years Ago
by Iam3R
…Blocks [code] int main() { if ( -1 < (
unsigned
char ) 1 ) printf("true 1\n"); if (… -1 < (
unsigned
short ) 1 ) printf("true 2\n"); if (…the following results[/QUOTE] I understood it clearly now. [CODE]
unsigned
char ch = 1; if ( -1 < ch )…
Re: unsigned character pointer to Hex values
Programming
Software Development
18 Years Ago
by Dave Sinkula
…#include <ctype.h>
unsigned
char *foo(
unsigned
char *dst, const
unsigned
char *src) { static const
unsigned
char nibble[] = { '0','…; 0xF ]; } *dst = '\0'; return start; }
unsigned
char *bar(
unsigned
char *dst, const
unsigned
char *src) {
unsigned
char *start = dst; while ( *src ) { if …
Re: unsigned and signed mix operation
Programming
Software Development
14 Years Ago
by Iam3R
…Banfa;1212496]why would -1 be converted to
unsigned
int when [icode](
unsigned
char) 1[/icode] can just be converted to… int which has more width than
unsigned
char and is already the type of -1?…CODE] if ( -1 < (
unsigned
char ) 1 ) if ( -1 < (
unsigned
short ) 1 ) if ( -1 < (
unsigned
int ) 1 ) if ( -1 …
unsigned long division operation
Programming
Software Development
16 Years Ago
by asilter
[code]
unsigned
long nBolum = 0L;
unsigned
long nKalan = 0L;
unsigned
long ulA = 0L;
unsigned
long ulB = 0L; ... printf("ulA=%u\n",ulA); …printf("ulB=%u\n",ulB); nBolum = (
unsigned
long) ulA/ulB; nKalan = (
unsigned
long) ulA%ulB; printf("nBolum = %u\n…
unsigned long % operation
Programming
Software Development
16 Years Ago
by asilter
[code]
unsigned
int nBolum = 0;
unsigned
long nKalan = 0L;
unsigned
long ulA = 0L;
unsigned
long ulB = 0L; ... printf("ulA=%u\n",ulA); …printf("ulB=%u\n",ulB); nBolum = (
unsigned
int) ulA/ulB; nKalan = (
unsigned
long) (ulA%ulB); printf("nBolum = %u\n…
unsigned and signed mix operation
Programming
Software Development
14 Years Ago
by Iam3R
… code is generating out put as " -1 < (
unsigned
char ) 1 ". i read in many books saying when… we do operation with singed and
unsigned
value always the resultant will be data type that has… more width . i understand that -1 when compared with
unsigned
should be coverted to unsigened int and yeild a big…
Unsigned char and an Array.
Programming
Software Development
13 Years Ago
by indigo.8
…I'm having a little problem with
unsigned
char and reading a file of integers …s suppose to dynamically create an array of
unsigned
char that is the correct size to read…problem is reading in the file into an
unsigned
char array. I've been told to do…ios::beg);//returns to front of file. pArray = new
unsigned
char [size]; for(i=0;i<size;i…
unsigned int in xcode
Programming
Software Development
12 Years Ago
by vincenzorm117
… const char * argv[]) { signed int minSignedInt={-2147483648},maxSignedInt={2147483647};
unsigned
int minUnsignedInt={0},maxUnsignedInt={4294967296}; printf( "sizeof( bool ) … integer) value = %d\n",maxUnsignedInt); printf("Min.
Unsigned
int (or integer) value = %d\n\n",minUnsignedInt);…
Re: unsigned and signed mix operation
Programming
Software Development
14 Years Ago
by Banfa
why would -1 be converted to
unsigned
int when [icode](
unsigned
char) 1[/icode] can just be converted to int which has more width than
unsigned
char and is already the type of -1? Did you mean to compare -1 and 1U?
Re: unsigned and signed mix operation
Programming
Software Development
14 Years Ago
by Ancient Dragon
…Blocks [code] int main() { if ( -1 < (
unsigned
char ) 1 ) printf("true 1\n"); if (… -1 < (
unsigned
short ) 1 ) printf("true 2\n"); if (… -1 < (
unsigned
int ) 1 ) printf("true 3\n"); if (…
Re: Unsigned char and an Array.
Programming
Software Development
13 Years Ago
by Ancient Dragon
… in the file will take up one character in the
unsigned
character array. So the number 123 till require 4 bytes… between them). Since you have to read them into an
unsigned
character array you can have to treat them as normal… end of file, tellg() to get file size, allocate the
unsigned
char array that size + 1, then call read() to read…
Re: Unsigned char and an Array.
Programming
Software Development
13 Years Ago
by indigo.8
…file in bytes. size = fileSize +1; pArray = new
unsigned
char *[size]; myStream.read(reinterpret_cast<char *> (pArray…),(size)*sizeof(
unsigned
char));//reads the whole file into pArray[/CODE] If …? Sorry having problems getting my head around the
unsigned
char idea. Do I even have to use …
Re: Unsigned char and an Array.
Programming
Software Development
13 Years Ago
by indigo.8
… star causes: [CODE]Error 1 error C2440: '=' : cannot convert from '
unsigned
char *' to '
unsigned
char **' [/CODE] The Array is defined as: [CODE…]
unsigned
char **pArray[/CODE] I got it to output using. [CODE]…
casting long int to unsigned int
Programming
Software Development
16 Years Ago
by asilter
…bytes in the system i'm programming. i printed sizeof(
unsigned
int) and it said 4. [code] int main(…int argc, char * argv[]) {
unsigned
int a = 0; long int b = 2607503366; /* the b …data type must strictly be a long int */ a = (
unsigned
int) b; printf("%d\n",a); return …
unsigned char into array of bits
Programming
Software Development
14 Years Ago
by TheWhite
…naturally) that contains 8 flag bits. Example: [CODE]
unsigned
char flag1:1, flag2:1, flag3:1, flag4:1… [/CODE] I would like to take this
unsigned
char and convert it into a bit array where…represents a flag. Pretty much like representing that
unsigned
char in its true binary form. Similar …
Re: unsigned and signed mix operation
Programming
Software Development
14 Years Ago
by Banfa
Sorry I am wrong about line 4, the compiler tries the available promotions then because the lhs is still
unsigned
it converts the rhs to
unsigned
and the comparison is performed on signed ints. The expression in line 4 is false where as all the other expressions are true.
Re: Unsigned char and an Array.
Programming
Software Development
13 Years Ago
by mike_2000_17
First, pArray should be declared as
unsigned
char* (no double stars). Allocate for pArray with new
unsigned
char[size]. If you are reading…
Re: Unsigned char and an Array.
Programming
Software Development
13 Years Ago
by indigo.8
… functions that I was given were written as so: [CODE]
unsigned
char ** C1dArray::get1dArray() { return pArray; } void C1dArray::set1dArray…(
unsigned
char **uc_img) { **pArray = **uc_img; }[/CODE] If I declare it with …
Re: unsigned long division operation
Programming
Software Development
16 Years Ago
by WaltP
You can't possibly get 155.419 from an [I]
unsigned
long[/I], there is no decimal point from integers. You need [I]float[/I] or [I]double[/I]. And dividing two integers always gives an integer, even if you load it into a floating point number. For example: [code=c] double dval; dval = 25/2; [/code] 12.000 is loaded into dval, not 12.5.
Re: unsigned long division operation
Programming
Software Development
16 Years Ago
by asilter
…]You can't possibly get 155.419 from an [I]
unsigned
long[/I], there is no decimal point from integers. You…
Re: unsigned char into array of bits
Programming
Software Development
14 Years Ago
by TheWhite
… best way to extract each bit from an 8-bit
unsigned
char. My goggling attempts for "bit masking in c… example of how I would extract a bit from an
unsigned
character using bit masking? If I understand correctly, simply masking… a few bits and changing them would just change the
unsigned
character to a different char. How would I extract each…
Re: unsigned and signed mix operation
Programming
Software Development
14 Years Ago
by Banfa
In lines 2 and 3 "1" can be promoted to int in line 4 "1" can be converted to int in line 5 "1" is already an int In all cases the compiler compares the values using the int type, -1 is not converted to
unsigned
. Actually I just checked the standard I will get back to you about line 4.
Re: Unsigned char and an Array.
Programming
Software Development
13 Years Ago
by Ancient Dragon
>>pArray = new
unsigned
char *[size]; Remove the star. You want to allocate an …
Re: Unsigned char and an Array.
Programming
Software Development
13 Years Ago
by Ancient Dragon
how is pArray declared? I thought it was [icode]
unsigned
char* pArray;[/icode] >> Is this bad practise? No, but if you had null-terminated the string then cout << would have worked too. splitting that string up into its individual itegers will require stingstream class and vector
Re: Unsigned char and an Array.
Programming
Software Development
13 Years Ago
by indigo.8
It's declared as
unsigned
char **pArray; I was given the member functions and had to write the definitions. It was the only way the array fit into it. Would it be possible to split with another array now that I know the size of the file?
Re: unsigned char into array of bits
Programming
Software Development
14 Years Ago
by yellowSnow
…lt;stdio.h> int main(void) { struct bits {
unsigned
char b8 :1, b7 :1, b6 :1, b5 …:1, b1 :1; }; union uchar { struct bits chbits;
unsigned
char ch; } mychar; printf("Enter a character: "…
Re: unsigned int in xcode
Programming
Software Development
12 Years Ago
by Narue
The %d specifier prints a signed int. If you want to print an
unsigned
value, use %u. Also, you'd be better off using INT_MIN, INT_MAX, and UINT_MAX from limits.h. That'll protect you from the off-by-one trap that you fell into with 4294967296.
Re: unsigned int in xcode
Programming
Software Development
12 Years Ago
by vincenzorm117
… prints a signed int. If you want to print an
unsigned
value, use %u. Also, you'd be better off using…
1
2
3
17
Next
Last
Search
Search
Forum Categories
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Forums
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC