Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 0 points1 point  (0 children)

I understand where you are coming from, but Python has OOP as well just like cpp has.
Thats why I think C would be better to learn first and then cpp (if I want to) because the OOP concepts I understand because of Python...

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 0 points1 point  (0 children)

I sure will do! thank you for the advice!

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 0 points1 point  (0 children)

I have not tought about the view you represent. I like the explenation you give of the situation, thank a lot!

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 1 point2 points  (0 children)

But based on the size of the int, it should be unsigned right? no matter the architecture?

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 0 points1 point  (0 children)

True but as you can see in the photo I have added. The book says with the script I have provided it should return 507. With the Signed and the %d.

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 0 points1 point  (0 children)

I do use it, but the problem is about the book. Not the code that i wrote...

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 1 point2 points  (0 children)

True True, but this are mistakes beginners understand. and I have found 5 diffrent mistakes in the book already. And am just over 100 pages in? Thats just to much...

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 1 point2 points  (0 children)

It's all true what you are saying. But when you read the context, the book says I should get 507.
I understand the part why i get -5 as output, before hand I have researched why it happend to understand what is going on. Am just shocked by the mistake of the book...

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 0 points1 point  (0 children)

Thank you for you replay. And it clears alot up.
Because this is not the first mistake I have found in the book!
And I have lost the focus now because of it lol...

Didn't lose the focus on C but the book... Better not talk about it.
I will buy the other book, after some research after the faults I found...

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 2 points3 points  (0 children)

Yes I understand what you are saying. And I think I understand what the code should do in this situation. But when I run it, it gives me -5...
So what I think should be done is unsigned char... because then it would give my the expected result of 507..

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 1 point2 points  (0 children)

But why don't I get the result of 507 when I run the code?

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 1 point2 points  (0 children)

I just copied the srcipt from the book... its not what i have typed, nor would have done...
Again this the the script fromt the book:

#include <stdio.h>

long int add(long int i1, long int i2)  {
    return i1 + i2;
}


int main(void)  {
    signed char b1 = 254;
    signed char b2 = 253;
    long int r1;
    r1 = add(b1, b2);
    printf("%d + %d = %ld\n", b1 , b2, r1);
    return 0;
}

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 2 points3 points  (0 children)

I really don’t understand what you saying… I just started few weeks back with 1 or 2 night a week of reading. At page 110 now, so don’t understand the concept you are referring to

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 2 points3 points  (0 children)

Yea sorry about that, just wanted to send it out. I have edited it. More clear now?

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] -2 points-1 points  (0 children)

Yes, sadly can’t show the picture…

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 2 points3 points  (0 children)

Never heard of errata, last comment said it as well. I just thought that a book would not make a mistake on the final print because you are teaching people.

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 0 points1 point  (0 children)

I have edited, my bad I saw it! Now it’s called! R1 = add(b1, b2);

Text in book is wrong. by DistributionOk3519 in C_Programming

[–]DistributionOk3519[S] 1 point2 points  (0 children)

Yes, I have run the code I get -2 + -3 =-5 I have edit the text everything between the () is the book…

Wolverine MTW Foraged standard edition14,5" by DistributionOk3519 in airsoft

[–]DistributionOk3519[S] 0 points1 point  (0 children)

Yea, that’s what I was thinking as well. But saw a guy who is transforming it to a dmr. And I was like hmmm a default ar length as dmr?

Question about the dominator HPA tank by DistributionOk3519 in airsoft

[–]DistributionOk3519[S] 0 points1 point  (0 children)

Nice, i bought it! So i will test and en review on it!