Where to go after "Teach yourself C in 21 days"

Programming, for all ages and all languages.
Post Reply
Aleks

Where to go after "Teach yourself C in 21 days"

Post by Aleks »

I'm currently working my way through the book "Sams Teach Yourself C in 21 days" and I was just wondering if anyone had any book recommendations for once I've completed it. At the end of the book it says something about learning C++ but I'd rather learn more advanced sides of C before I move on to C++.

Also where can I find some good C++ for C users?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Where to go after "Teach yourself C in 21 days"

Post by Solar »

I'd suggest to come up with some (simple) tool you'd like to implement, and do that. Nothing teaches you the fine print of a language like using it.

Pick something nonsensical, so you don't get lured into scope creep or trying to actually "release" your first steps. A "traditional" project would be a name / mail / phone number database.

As for learning C++, Stroustrup's "The C++ Programming Language" is the bible of course, but some consider it a bit hard for beginners. I learned my C++ using that book and the MaxonC++ v3 tutorial, but the latter is hard to come by these days. (Don't even try. ;-) )
Every good solution is obvious once you've found it.
Kemp

Re:Where to go after "Teach yourself C in 21 days"

Post by Kemp »

Quick advice from me (as I can't tell your view on this from your post), don't look at C++ as just an expanded version of C. There are a lot of things you can do (or are required to do) in C that are very bad practice in C++, in fact I have read C++ books that never mention this and continue writing C++ code as essentially C code with access to the STL.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Where to go after "Teach yourself C in 21 days"

Post by Solar »

Correct. If you see [tt]void *[/tt], C-style casts, arrays or [tt]char *[/tt] in C++ code, beware - the author came from C and didn't learn. 8)
Every good solution is obvious once you've found it.
Kemp

Re:Where to go after "Teach yourself C in 21 days"

Post by Kemp »

As a side-note, I didn't come from C, but unfortunately still managed to learn the things Solar mentioned in my early C++ days, learn by not doing what I do ;D
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Where to go after "Teach yourself C in 21 days"

Post by Solar »

Just to show the other side, if you see classes with member functions like "hasNext()" or "getNextElement()", libraries where every class derives from the same abstract base class, or where polimorphism is used extensively but templates are nowhere to be seen - run. That's code written by a Java programmer who didn't learn, and the C coders at least know their way around pointers... :-D
Every good solution is obvious once you've found it.
Dex4u

Re:Where to go after "Teach yourself C in 21 days"

Post by Dex4u »

Maybe move on to "teach yourself assembly, in 8 years and 21 days" ;D .
Aleks

Re:Where to go after "Teach yourself C in 21 days"

Post by Aleks »

Dex4u wrote: Maybe move on to "teach yourself assembly, in 8 years and 21 days" ;D .
LoL. I would like to learn a bit of Assembly one day and maybe see what it's like to piece together an extrememly simple operating system, but lets take one thing at a time :)
Dex4u

Re:Where to go after "Teach yourself C in 21 days"

Post by Dex4u »

I wish you luck with learning C programming Aleks, i have programmed in many languages, but could not get the hang of C programming, by this i mean you start by looking every thing up when writing a program in a new language, but as you learn more, you start to write code, with out needing to look up how you do some bit of code.

With C this stage never came, it just did not seem logical, i found ASM one of the easiest to learn :o .
But then, it may just be, it suited me ?.

I mean how simple is this to boot to pmode:

Code: Select all

;************************************
; \\|//
; (@ @)
; Dex4u
;
; Assemble with fasm
; c:\fasm Testboot.asm Testboot.bin
;
;************************************
org 0x7C00

use16
;****************************
; Realmode startup code.
;****************************

start:
        xor   ax,ax
        mov   ds,ax
        mov   es,ax
        mov   ss,ax
        mov   sp,0x7C00
;*****************************
; Setting up, to enter pmode.
;*****************************
        cli
        lgdt  [gdtr]

        mov   eax, cr0
        or    al,0x1
        mov   cr0,eax

        jmp   0x10: protected
;*****************************
; We are entering Pmode. 
;*****************************
use32
protected:
        mov   ax,0x8
        mov   ds,ax
        mov   es,ax
        mov   ss,ax
        mov   esp,0x7C00
;*****************************
; Turn floppy off (if space).
;*****************************
        mov   dx,3F2h
        mov   al,0
        out   dx,al
;*****************************
; Print a P if we enter Pmode. ;-)
;*****************************
        mov byte [es:0xB8000], 'P'

???jmp   $
;*************************************
; GDT.
;*************************************
gdt:        dw    0x0000, 0x0000, 0x0000, 0x0000
sys_data:   dw    0xFFFF, 0x0000, 0x9200, 0x00CF
sys_code:   dw    0xFFFF, 0x0000, 0x9800, 0x00CF
gdt_end:

gdtr:???    dw gdt_end - gdt - 1
???    dd gdt

;*************************************
; Make program 510 byte's + 0xaa55
;*************************************

times 510- ($-start)  db 0
dw 0xaa55
Aleks

Re:Where to go after "Teach yourself C in 21 days"

Post by Aleks »

Doesn't look the least bit simple.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Where to go after "Teach yourself C in 21 days"

Post by Solar »

Well, for a bootblock it's relatively simple. Probably because he doesn't any booting. 8)
Every good solution is obvious once you've found it.
Dex4u

Re:Where to go after "Teach yourself C in 21 days"

Post by Dex4u »

Remember this is not just a boot to realmode, which would be a lot simpler, but a boot to pmode.
Post Reply