learning c/c++

Programming, for all ages and all languages.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: learning c/c++

Post by Mikemk »

I can get that.

EDIT:
Thank you.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: learning c/c++

Post by Kazinsal »

Awesome, enjoy it. It's a great book, even if the edition in C used in it is a bit archaic at times.
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: learning c/c++

Post by Antti »

I struggled one night with printing decimal numbers because I wanted to figure it out by myself. Now that I know how to do that, it is simple and obvious. However, I did not have it right away. Albeit my implementation differs from this, the K&R book gives the answer. I should have read it more carefully.

Code: Select all

/* C Programming Language, 4.10 Recursion, page 73 */

#include <stdio.h>

/* printd: print n in decimal */
void printd(int n)
{
	if (n < 0) {
		putchar('-');
		n = -n;
	}
	if (n / 10)
		printd(n / 10);
	putchar(n % 10 + '0');
}
Opcode
Member
Member
Posts: 29
Joined: Mon Apr 01, 2013 2:50 pm

Re: learning c/c++

Post by Opcode »

Thanks for the link--I was a little hesitant about posting one. This book is considered by most to be the bible of the C world--as such a hard copy should be obtained if your wallet and locale permit it. Worst case is you have a nice showpiece for your bookshelf. (I would be your friend if I walked into your home and saw this on your bookshelf :D )

Now for my rant:

So Steve Jobs dies--media/fanboys go bonkers.

4 days later...Dennis Richie dies......
.....
.....
.....
.....
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: learning c/c++

Post by Griwes »

Opcode wrote:
Griwes wrote:Plus, what I vtable?
That's not even a sentence.
That's *obviously* a typo, fixed now. Should've been "Plus, what is a vtable?".
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: learning c/c++

Post by Mikemk »

Opcode wrote:Now for my rant:

So Steve Jobs dies--media/fanboys go bonkers.

4 days later...Dennis Richie dies......
.....
.....
.....
.....
Who is/was Dennis Richie?
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: learning c/c++

Post by Mikemk »

Oh, I see
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: learning c/c++

Post by Brynet-Inc »

m12 wrote:Who is/was Dennis Richie?
m12 wrote:Oh, I see
That was terrible.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: learning c/c++

Post by Mikemk »

Brynet-Inc wrote:
m12 wrote:Who is/was Dennis Richie?
m12 wrote:Oh, I see
That was terrible.
I was being serious, no joking. I had never heard of him.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: learning c/c++

Post by Love4Boobies »

I would start with the second book here, the C Programming Language, 2nd ed. Feel free to look over the rest of the list.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
BMW
Member
Member
Posts: 286
Joined: Mon Nov 05, 2012 8:31 pm
Location: New Zealand

Re: learning c/c++

Post by BMW »

Brendan wrote:
I'm NOT saying that C++ is bad (it is, but I'm not saying it ;) ). What I am saying is that C is a lot closer to assembly and a lot easier for an assembly language programmer to get used to.
Haha, I agree. Only for OS Dev though. No programming language is really useless, it just depends what you use it for.

Back in my Game Dev days, C++ was king.
Currently developing Lithium OS (LiOS).

Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: learning c/c++

Post by Love4Boobies »

BMW wrote:No programming language is really useless, it just depends what you use it for.
On what grounds do you make this claim?
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: learning c/c++

Post by Kazinsal »

Love4Boobies wrote:
BMW wrote:No programming language is really useless, it just depends what you use it for.
On what grounds do you make this claim?
On the grounds that he has clearly never worked with Befunge or Malbolge.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: learning c/c++

Post by Love4Boobies »

I don't think anyone has ever been able to write a Malbolge program---not even as much as a "hello, world!" For a long time it wasn't even known which type of language it is; it was thought to be a LBA but was eventually proven to be Turing-complete.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: learning c/c++

Post by Kazinsal »

Love4Boobies wrote:I don't think anyone has ever been able to write a Malbolge program---not even as much as a "hello, world!" For a long time it wasn't even known which type of language it is; it was thought to be a LBA but was eventually proven to be Turing-complete.
There are a couple simple ones, but they took years to figure out from what I know. A hello world, for example:

Code: Select all

('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#"
`CB]V?Tx<uVtT`Rpo3NlF.Jh++FdbCBA@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg${z@>
Makes unmaintained, poorly-crafted x86 assembly language look like C64 BASIC.
Post Reply