Problem Learning

Posts 31–41 of 41 · Page 3 of 3
Hey I HD, must like you, because he went through the trouble of answering you questio even though he was banned....

Quote Originally Posted by ilovecookies View Post
Ooooh oh oh oh, I should've went with my original coding which included the cout object so it can display the content of the character pointer. But what differs a character pointer from a variable? Or are these questions i'll have answered by the book soon enough?
Here's what he said:
Quote Originally Posted by Hell_Demon
a char pointer points to a character or character array.
now you can return a single character in your function, but if you want to return more you'll have to return the pointer to the array, thus making the function type a char *
Quote Originally Posted by why06 View Post
Hey I HD, must like you, because he went through the trouble of answering you questio even though he was banned....



Here's what he said:
Thanks alot for relaying the message Why! What'd HD get banned for?
Anyways i've been analyzing the code for it, and i'm still kinda confused such as
Code:
return retbuf
but i'm confident enough to move on without worrying about getting lost. Right now i'm working through all the different variable types and headers, such as long, unsigned long, signed long etc, etc. And it makes me feel as though maybe i'll want to learn a few simple side things such as getting a good understanding of hexidecimal.

Because ANY type of number can apparently be stored in a number of different variable types. It compared it like this.

Code:
int soda=42
int pepsi=0x042
While they have different values, it's still technically allowed.

I also got my first taste of #define. It went through the <climits> file and defined ZERO as 0.

So I'm digging this whole thing, like it's technical, but there's always a reason behind why it failed or why it worked.
Quote Originally Posted by ilovecookies View Post
Thanks alot for relaying the message Why! What'd HD get banned for?
I got banned for insulting the feeling of some rather ch00bish VBFags

Quote Originally Posted by ilovecookies
I want to learn a few simple side things such as getting a good understanding of hexidecimal.

Because ANY type of number can apparently be stored in a number of different variable types. It compared it like this.

Code:
int soda=42
int pepsi=0x042
While they have different values, it's still technically allowed.
Decimal numbers have a base of 10:
0,1,2,3,4,5,6,7,8,9
which means there are 10 numbers(0 to 9) that fit into 1 'slot'

Hex(adecimal) has a base of 16(Decimal means 10, hex means 6, 6+10=16 )
0x0,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,0xA,0xB,0x C,0xD,0xE,0xF
which means that there are 16 'numbers'(0x0 to 0xF) that fit into 1 'slot'.

if you go over the maximum number for a 'slot' a new 'slot' is used and placed infront of it, example:
0xF, if i want to go 1 higher it will be 0x10
0x1F +1 will be 0x20, and so on untill you reach
0xFF, +1 on that will be 0x100.

0xFFF:
15*16^2=3840
15*16^1= 240
15*16^0= 15+
============
4095


0xB92 - start at the right side
for the 2 we have moved 0 characters to the left.
so the value of that 2 in decimal is:
2*16^0=2, since 16^0 is 1.

for the 9 we have moved 1 character to the left.
so the value of that 9 in decimal is:
9*16^1=144, since 16^1 is 16

for the B we have moved 2 characters to the left.
so the value of that b in decimal is:
11*16^2=2816, since 16^2 is 256.



Then there is also octal(octo means 8, so it has a base of 8 )
0,1,2,3,4,5,6,7
for octal to decimal
2471(octal) = 1337 in decimal.
1*8^0=1
7*8^1=56
4*8^2=256
2*8^3=1024
1024+256+56+1=1337

and binary has a base of 2
0 and 1
for binary to decimal:
11001(bin) = 25 in decimal.
1*2^0 = 1
0*2^1 = 0
0*2^2 = 0
1*2^3 = 8
1*2^4 = 16
16+8+0+0+1 = 25


I hope that explained it for you.
Soooo lets say I had 0xf64, I comprehend converting it, via your excellent explanation, It would break down as such 4 * 16^0 + 6 * 16^1 + 16*16^2 = 4+96 +4096 = 100 + 4096 = 4196

But does it continue in that same pattern? Such as if I had 9x00FC5

Does the x hold a place value? Let me make it a little clearer

5 = 5*16^0
C = 12*16^1
F=16*16^2
0=0*16^3
0=0*16^4
x=?

And thus my main question. Should x hold a place value, would the 9 that begins it be like this

9 = 9*16^6 or
9 = 9*16^5


EDIT! Another question. Why are ram addy's stored via hex? If I converted the addy to decimal would it have the same effect?
Quote Originally Posted by ilovecookies View Post
Soooo lets say I had 0xf64, I comprehend converting it, via your excellent explanation, It would break down as such 4 * 16^0 + 6 * 16^1 + 16*16^2 = 4+96 +4096 = 100 + 4096 = 4196

But does it continue in that same pattern? Such as if I had 9x00FC5

Does the x hold a place value? Let me make it a little clearer

5 = 5*16^0
C = 12*16^1
F=16*16^2
0=0*16^3
0=0*16^4
x=?

And thus my main question. Should x hold a place value, would the 9 that begins it be like this

9 = 9*16^6 or
9 = 9*16^5


EDIT! Another question. Why are ram addy's stored via hex? If I converted the addy to decimal would it have the same effect?
hex always starts with 0x, so if u scan backwards and encounter an x you know you're done

as to your edit:
Yes, since in the end its all binary I guess
Quote Originally Posted by Hell_Demon View Post
hex always starts with 0x, so if u scan backwards and encounter an x you know you're done

as to your edit:
Yes, since in the end its all binary I guess
Alright thanks alot man! You've been a great help!
Quote Originally Posted by ilovecookies
4*16^0 + 6 * 16^1 + 16*16^2 = 4+96 +4096 = 100 + 4096 = 4196
F is 15 not 16 btw.

so the part in bold should be 15*16^2 which is 3840
4+96+3840=3940
Quote Originally Posted by Hell_Demon View Post
F is 15 not 16 btw.

so the part in bold should be 15*16^2 which is 3840
4+96+3840=3940
Alright, I get what you're saying but this brings up a whole new question.

Hexidecimal = Hex + Decimal = 6 + 10 = 16.

1-2-3-4-5-6-7-8-9-A-B-C-D-E-F = 15

Which brings this question....why? Why not call it Pentadecimal? Is it Hexadecimal because for some reason the 16th is null? Or is this one of those Absolute Facts?
Quote Originally Posted by ilovecookies View Post
Alright, I get what you're saying but this brings up a whole new question.

Hexidecimal = Hex + Decimal = 6 + 10 = 16.

1-2-3-4-5-6-7-8-9-A-B-C-D-E-F = 15

Which brings this question....why? Why not call it Pentadecimal? Is it Hexadecimal because for some reason the 16th is null? Or is this one of those Absolute Facts?
0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F = 15

you always start with a zero...

so 9 isn't the 9th nr but the 10
Quote Originally Posted by lalakijilp View Post
0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F = 15

you always start with a zero...

so 9 isn't the 9th nr but the 10
Oooo! Ok that makes sense. I'm tarded and forgot the zero. Thank ya!
lol.. wtf ? i dont get that at all .. but somehow i can still code :P
Posts 31–41 of 41 · Page 3 of 3
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us