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.Learning C
#1
Posted 15 February 2009 - 09:21 AM
#2
Posted 16 February 2009 - 10:22 PM
#3
Posted 18 February 2009 - 09:08 AM
"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
Posted 18 February 2009 - 09:38 AM
Quote
Do you read the questions before you answer? He said he was looking to learn C.
#5
Posted 18 February 2009 - 11:39 AM
"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
Posted 18 February 2009 - 01:36 PM
Quote
I use assembly for writing assembly. Weird, huh?
EDIT: Ok, in all fairness, the compiler is C based.
#7
Posted 19 February 2009 - 10:33 AM
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
This post has been edited by Romeo29: 19 February 2009 - 10:38 AM
#8
Posted 22 February 2009 - 04:29 PM
"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
Posted 01 March 2009 - 02:46 PM
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!
This post has been edited by CyberSorcerer: 01 March 2009 - 07:05 PM
#10
Posted 07 March 2009 - 09:52 AM
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.
Good luck!
This post has been edited by groovicus: 07 March 2009 - 10:14 AM
#11
Posted 07 March 2009 - 04:59 PM
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
Posted 24 March 2009 - 10:57 AM
CyberSorcerer, on Mar 1 2009, 03:46 PM, said:
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
"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
Posted 24 March 2009 - 11:03 AM
burn1337, on Mar 7 2009, 05:59 PM, said:
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
"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
Posted 23 April 2009 - 04:28 AM
can anyone suggest me any tutorial site for c++ ?
#15
Posted 23 April 2009 - 11:59 AM

Help


Back to top












