Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Learning C


  • Please log in to reply
15 replies to this topic

#1 OmegamB

OmegamB

  • Members
  • 56 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:US
  • Local time:01:07 PM

Posted 15 February 2009 - 09:21 AM

I've been looking into learning C and was wondering if someone could point me to some good learning resources and books. Thanks!

Posted Image


BC AdBot (Login to Remove)

 


#2 Nile

Nile

  • Members
  • 79 posts
  • OFFLINE
  •  
  • Local time:12:07 PM

Posted 16 February 2009 - 10:22 PM

Do you know an C-Style languages? If you do, it should be easier.

#3 ryan_w_quick

ryan_w_quick

  • Members
  • 488 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:12:07 PM

Posted 18 February 2009 - 09:08 AM

any local college probably carries something. so are you looking into assembly or something different?
"To do less than your best is to sacrifice the gift." Steve Prefontaine

"The things you own end up owning you." Tyler Durden

"I do not feel obliged to believe that the same god who has endowed us with sense, reason and intellect has intended us to forgo their use." Galileo

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:10:07 AM

Posted 18 February 2009 - 09:38 AM

any local college probably carries something. so are you looking into assembly or something different?


Do you read the questions before you answer? He said he was looking to learn C.

#5 ryan_w_quick

ryan_w_quick

  • Members
  • 488 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:12:07 PM

Posted 18 February 2009 - 11:39 AM

which part of my statement are you referring to? I learned C my freshmen year at IUPUI, so i know there's books there that would help someone learn. And ive used C for assembly and other things.
"To do less than your best is to sacrifice the gift." Steve Prefontaine

"The things you own end up owning you." Tyler Durden

"I do not feel obliged to believe that the same god who has endowed us with sense, reason and intellect has intended us to forgo their use." Galileo

#6 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:10:07 AM

Posted 18 February 2009 - 01:36 PM

And ive used C for assembly and other things.


I use assembly for writing assembly. Weird, huh? :thumbsup:

EDIT: Ok, in all fairness, the compiler is C based.

#7 Romeo29

Romeo29

    Learning To Bleep


  • BC Advisor
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:11:07 AM

Posted 19 February 2009 - 10:33 AM

You need a FREE C/C++ compiler first:
1. Pelles C Compiler for Windows
2. GCC is already installed on linux systems. You can get CodeBlocks(with GCC) for Windows from http://www.codeblocks.org/
3. Digital Mars (http://www.digitalmars.com/) for Windows and Linux

You can google for C compiler.


A few tutorials to get you started with:

1. http://www.physics.drexel.edu/students/cou...neral/C_basics/
2. http://www.iu.hio.no/~mark/CTutorial/CTutorial.html

Edited by Romeo29, 19 February 2009 - 10:38 AM.


#8 ryan_w_quick

ryan_w_quick

  • Members
  • 488 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:12:07 PM

Posted 22 February 2009 - 04:29 PM

And ive used C for assembly and other things.


I use assembly for writing assembly. Weird, huh? :thumbsup:

EDIT: Ok, in all fairness, the compiler is C based.


all im saying is that the c compiler i use for embedded systems generates the assembly code as well.
"To do less than your best is to sacrifice the gift." Steve Prefontaine

"The things you own end up owning you." Tyler Durden

"I do not feel obliged to believe that the same god who has endowed us with sense, reason and intellect has intended us to forgo their use." Galileo

#9 CyberSorcerer

CyberSorcerer

    Malware Reverse Engineer


  • Members
  • 99 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Las Vegas
  • Local time:09:07 AM

Posted 01 March 2009 - 02:46 PM

Hello

Alright as someone who does a lot of reverse engineering of malware I'm going to try and give my insight to the discussion here.

Assembly is actually a class of languages, not one language. Every computer platform has its own assembly language that is usually quite different from all the rest. A compiler takes the code and transforms it into something that computer can understand which is machine code. This brings up another important fact and that is; machine code (often called binary code, or object code) is not the same thing as assembly.

A CPU reads machine code, which is nothing but seqences of bits that contain a list of instructions for the CPU to perform. Assembly language is just a textual representation of those bits. For anyone that has run a program through a disassembler will see a series of hex numbers to the left of the assembly language. Those number are what the computer understands, the assembly instructions are there only for us to be able to understand. So for example when you see "33DB" then to the right of that is "XOR EBX, EBX" which is just an english representation of that opcode for our benefit.

Embedded systems are much different. Most good ones are programmed directly in assembly because of memory limitations in embedded systems and assembly runs much faster than C/C++ or any other high-level langauage. You can use assembly inside C and the compiler will understand the assembly without much translation which greatly speeds up the program, but C does not output assembly directly. A good place where assembly is used a lot is in game programming for instance.

A compiler will take the text file of the code and first check it for syntax errors and get it ready for code optimization. This code optimization is something you'll have to understand fully if your going to get into reverse engineering because it will change the code quite considerably if your don't understand what it is optimizing. Then the last step is to output and make the actual executable. There is much more to compilers that what I mention, but you can find more information with Google if your interested. It is an interesting subject to learn, but not easy to comprehend for most.

I hope I didn't confuse anyone!

Edited by CyberSorcerer, 01 March 2009 - 07:05 PM.


#10 Iridium

Iridium

  • Members
  • 5 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:the Netherlands
  • Local time:05:07 PM

Posted 07 March 2009 - 09:52 AM

Basics: http://www.howstuffworks.com/c.htm
Pointers, arrays and strings: http://home.netcom.com/~tjensen/ptr/pointers.htm
These should be very helpful. Also, do not underestimate google and wikipedia for quick lookups.

The best way to start is just write some silly programs that does nothing but test your current skills (that's the way they do it in college). After hello world, try some addition, division and array searching functions, play around with loops using printing functions to make things visible in your favourite command prompt. Then try bitwise and logical operations, you could try analyzing strings, or bitwise shifts. This should all make sense when you read some of the basic tutorials.

A few goals for when you get further: Try building an INI parser, it was one of the most exciting things I made when I just started. :thumbsup:

Good luck! :flowers:

Edited by groovicus, 07 March 2009 - 10:14 AM.


#11 burn1337

burn1337

  • Banned
  • 311 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:08:07 AM

Posted 07 March 2009 - 04:59 PM

Nicely said there Cyber... I was beginning to wonder how many people here actually understood the whole programming concept, and if anyone would understand past that lol... Mr. IUPUI... I think you may want to go back to school... Or at least re-read some of those books... Though Cyber has more then said what I was gonna say...
Omegam - I suggest going to Barnes N Noble... They have a lot of good books... Just make sure to find something for beginners... Unless you already program... Cause otherwise, you may get pretty lost...

#12 ryan_w_quick

ryan_w_quick

  • Members
  • 488 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:12:07 PM

Posted 24 March 2009 - 10:57 AM

Hello

Alright as someone who does a lot of reverse engineering of malware I'm going to try and give my insight to the discussion here.

Assembly is actually a class of languages, not one language. Every computer platform has its own assembly language that is usually quite different from all the rest. A compiler takes the code and transforms it into something that computer can understand which is machine code. This brings up another important fact and that is; machine code (often called binary code, or object code) is not the same thing as assembly.

A CPU reads machine code, which is nothing but seqences of bits that contain a list of instructions for the CPU to perform. Assembly language is just a textual representation of those bits. For anyone that has run a program through a disassembler will see a series of hex numbers to the left of the assembly language. Those number are what the computer understands, the assembly instructions are there only for us to be able to understand. So for example when you see "33DB" then to the right of that is "XOR EBX, EBX" which is just an english representation of that opcode for our benefit.

Embedded systems are much different. Most good ones are programmed directly in assembly because of memory limitations in embedded systems and assembly runs much faster than C/C++ or any other high-level langauage. You can use assembly inside C and the compiler will understand the assembly without much translation which greatly speeds up the program, but C does not output assembly directly. A good place where assembly is used a lot is in game programming for instance.

A compiler will take the text file of the code and first check it for syntax errors and get it ready for code optimization. This code optimization is something you'll have to understand fully if your going to get into reverse engineering because it will change the code quite considerably if your don't understand what it is optimizing. Then the last step is to output and make the actual executable. There is much more to compilers that what I mention, but you can find more information with Google if your interested. It is an interesting subject to learn, but not easy to comprehend for most.

I hope I didn't confuse anyone!


im not really interested in reverse engineering.

but in many embedded systems, am i correct in saying that you dont always want the code to optimize? especially when reading addresses of switches, ports, etc.?

and i am somewhat familiar with using assembly in the order of writing interrupts in my c code. not much else to this point
"To do less than your best is to sacrifice the gift." Steve Prefontaine

"The things you own end up owning you." Tyler Durden

"I do not feel obliged to believe that the same god who has endowed us with sense, reason and intellect has intended us to forgo their use." Galileo

#13 ryan_w_quick

ryan_w_quick

  • Members
  • 488 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:12:07 PM

Posted 24 March 2009 - 11:03 AM

Nicely said there Cyber... I was beginning to wonder how many people here actually understood the whole programming concept, and if anyone would understand past that lol... Mr. IUPUI... I think you may want to go back to school... Or at least re-read some of those books... Though Cyber has more then said what I was gonna say...
Omegam - I suggest going to Barnes N Noble... They have a lot of good books... Just make sure to find something for beginners... Unless you already program... Cause otherwise, you may get pretty lost...


i am the first to admit that my programming experience is limited, and that i've only used c and assembly to a much more limited extent. and i am still in school, so its a bit premature implying that i should go back. but enough about me

seriously, campuses are a good source for a lot of literature that you are looking for. You can find used or damaged books at very cheap prices. but who needs to own? why not just visit a local library? i would not suggest paying top dollar for a book that may become obsolete to you very quickly, depending on how quickly you can pick up the concepts
"To do less than your best is to sacrifice the gift." Steve Prefontaine

"The things you own end up owning you." Tyler Durden

"I do not feel obliged to believe that the same god who has endowed us with sense, reason and intellect has intended us to forgo their use." Galileo

#14 Mandy12

Mandy12

  • Members
  • 2 posts
  • OFFLINE
  •  
  • Local time:11:07 AM

Posted 23 April 2009 - 04:28 AM

How can we learn c++ ?
can anyone suggest me any tutorial site for c++ ?

#15 Romeo29

Romeo29

    Learning To Bleep


  • BC Advisor
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:11:07 AM

Posted 23 April 2009 - 11:59 AM

How can we learn c++ ?
can anyone suggest me any tutorial site for c++ ?


Look at the pinned post(Best programming guides ever) on the top in the Programming section. :thumbsup:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users