As with all programming languages starting with the syntax is always your best bet, so you're on the right track. Once you know the basics, all you really then need is a point of reference and you can code in any language.
Get the following things down pat and you should be alright:
1. Syntax All languages have specific word orders in order to achieve the same result. Java and C for example declare the variable TYPE first and then the descriptor/name for the variable. Visual Basic declares the variable descriptor/name FIRST and then the variable type. Where as you have other languages which don't have to define a type for the variable at all, it's decided what type to make it once it's interpreted, a good example of this is PHP.
2. Variables / Variable TypesLearn the variable types. Most languages have similar base types for variables called PRIMITIVES. Then there are other variable types which are system or user defined called OBJECTS. You'll get more into objects later as you progress. Where most languages have the same set of primitives, there are some languages which have their own custom types, C and c++ for example have char where as there's no real alternative for this in Java. One important thing to take note of when becoming an efficient programmer is choosing the right variable for the job.
For example, you may think that an integer just another variable to hold a number, and while you would be right, each data type has a limit on the amount of bytes it takes up, and thus the amount of data it can hold. So if you only ever needed to hold a number that's 2 digits long and doesn't use floating points, you'd never need to use a long, or a double or a float. So choosing the right size variable and type of variable can be important. Most programmers don't care and will choose the biggest one because memory is so readily available these days, and you can choose which programmer you want to be, but when dealing with shellcodes etc you want the smallest possible footprint.
Variable sizes and limits are largely dependent on the language you are using and the platform you are running on (x86 x64), and there are plenty of references on line to find out which language takes up how much space and what data it can hold. Here's an example:
Edit: example removed, because tables aren't working properly on the board? Need to get that fixed. See below.
Source: http://www.cplusplus.com/doc/tutorial/variables/3. LoopsThere are only a few, but it's important to use the right one to be classified as a good programmer. In general here is the rule I follow.
Do you know when the loop is going to end?
- YES (use a for loop), e.g.
for (int i=0; i<10; i++) {
// loop for 10 iterations only.
}
for (initialization; termination; increment) { statement(s) }
- NO (use a while loop), e.g.
while (unknown_condition == false) {
// do some work until unknown_condition == true
}
These loops in general are available in all languages interpreted or compiled so you will definitely need to get used to using them. Some languages also have a foreach or for each loop which can be used to iterate
1 through a collection of objects. If you ever need to use one, I'm sure one of us will be willing to help you if you can't figure out how to use it properly.
4. ...Profit? Nah I dunno, at the moment I can't think of anything else although I'm sure there is for the basics, I'll add more in if I think of any later, but basically. If you get those steps down and just play around with the language, you'll eventually get the point where you can knock something together that actually does something. It takes some time, but believe me, it's damned fun once you get the hang of it.
Any questions, post here, or you can find most of us on the IRC.
(SSL - recommended ) irc.evilzone.org port 6697 or 9999, channel #evilzone. See you there
-- xor
1. Iteration means the act of repeating a process usually with the aim of approaching a desired goal or target or result... http://en.wikipedia.org/wiki/Iteration