i was just wondering if there is some special technique to understand the code which is not yours.i may sound peculiar so letme make it a bit clear.i hav just recently done some c++ programming and being able to make some programs.not too complex but i can do some very basic programming .....
i am able to solve most of the problems myself,but when i look at someone else's code,it takes me a while and lot of effort to understand it.....
i hav heard of the topdown and bottomup approach of designing a program,but can the same approach be used in understanding it?
i am not a professional of programming just an amateur so if i sound too stupid plz forgive me...
thanx in advance..

A general description of the goal(s) and comments within the code are probably the single biggest help. For this reason, you should ALWAYS make sure that your own code is well commented.

Believe it or not, code can be considered written communication (like a book or technical manual) as well. Programmers that understand this will write code that is easy to follow. Use of relevant names/identifiers and consistent application of naming conventions can convey a lot of information very easily. Sometimes code that does this well is referred to as "Self-commenting code" and is even more useful than good commenting.

Beyond that, it's just a matter of following the code and tracking down the various typedefs, function definitions, class definitions, etc.

It's not as hard as some people make it out to be for instance I can understand more code than I have the ability to write my advice is read the program like a book start at the top because that's usually where the foundation of the rest of the code is is all the variable names the classes and includes if you run across a function you don't understand and there's a header you've never seen before chances are the declaration of that function is in that header or one of it's associated headers. If you use a IDE like codeblocks and the code compile that means the associated header is included then all you have to do is right click find declaration or find implementation. Hope that helped a little bit I always think of it as a instruction guide that tells the computer what to do to "build" your application. And no you don't sound stupid it's a very valid question I hope that it helps you understand code a little better so that when other people need this info its only a search away.

The best way is to get the original coder to explain it to you. If thats not possible, use the code( if you need to ) for your needs as long as you know what its supposed to do and not necessarily how it does it. If all fails then you just read it step by step. Use the debugger if you need to, start from main and follow its execution( if possible ), and go from there.

>> The best way is to get the original coder to explain it to you.

If the code is well written/documented, the coder has already written and documented it so that it can be understood. If you have to ask them, to my mind, that means it wasn't written well enough. You can never assume that the author will still be around. People change jobs, die, retire, etc. We've all been in the position where we have to go through some ex-employee's impossible-to-understand code. We've all had fantasies of murder when doing so (well, maybe not all of us. We've all been frustrated by a lack of comments).

Code is meant to be read and maintained, not just executed. It could be the most brilliant code ever written. Unless it's perfect and no one ever has to touch it again or only the person who wrote it has to deal with it, it's worthless if you can't read it.

commented: Preach it Vernon! :) +5

thanx to all for your advices........that really helped...