This style of writing code is taught to us at our college.And this code runs well over Turbo C++ 3.0 compiler(16 bit).

[b]fault 1:[/b] if I compile this code over any latest version of Compiler like VC++, Turbo C++ 2006 etc.(32 bit). graphics.h not found.

ok ok this code might be made for a 16 bit environment, but [u][italic]if I want to check for DDAline drawing or Bresenham line drawing alogorithms over a 32 bit env. then what header files are to be included and what functions will be used for putting pixel or drawing line.[/italic][/u]

[b]fault 2:[/b] Here we are writing void main() and it works without a single warning. why we need to write int main()....why OS need integer to be returned.

Comments

[color=Blue]1. You will have to create a simple Win32 application in modern compiler and then draw your elements in response to WM_PAINT message. Of course, first, you need to know the main principle of Win32 coding - read Charles Petzold if you are a very beginner.

2. "int main (...)" is a standard today, so today's compiler will give a warning. The return value from main() is used in scripting and BAT files. And if one process executes another process - there is a way to obtain the return code from the child process and use it in further logic of parent process.[/color]

void main() was never allowed during the time TC was around either, it is a Borland extension to the standard and not valid ISO C.

It is mainly Borland's fault that so many people incorrectly believe that void main() is acceptable in DOS/Windows applications. It has never been allowed since the C language was standardized around 1990.

: ok I do not know anything about windows programming.: : but as per AsmGuru62's advice i downloaded "Microsoft - Programming : Windows API 5th" by charles petzold, and i need some time for : learnig that.: : so can anyone plz show me a sample code for drawing the Pixel : Coordinates using 32 bit compiler like VC++.: : Another Doubt is:: those type of programming, i mean program under WinMain() is a part : of C language?: I mean, as main() is supported by all the C compilers. is WinMain() : also.: [color=Blue]WinMain() is part of Windows code. It will be compiled only by Windows compiler.[/color]

: Q: How, such a division of 32 bit or 16 bit compiler is made. is : there any 64 bit compiler also...?: [color=Blue]Get free Visual C++ Express - it should be able to generate 64-bit code.[/color]

: I am Highly confused about the compilers....to learn C/C++...what : type of Programming I need to learn.....varities of compiler makes : me confuse.: : Plz tell me what should I do?: : [color=Blue]Good compilers come from Microsoft, Borland and Intel. I believe, first two are free, but Intel - you need to pay for it, but Intel is optimizing slightly better than other two. And Intel compiler does not have the IDE.[/color]:

: ok I do not know anything about windows programming.: : but as per AsmGuru62's advice i downloaded "Microsoft - Programming : Windows API 5th" by charles petzold, and i need some time for : learnig that.: : so can anyone plz show me a sample code for drawing the Pixel : Coordinates using 32 bit compiler like VC++.

There are examples in Petzold.

: Another Doubt is:: those type of programming, i mean program under WinMain() is a part : of C language?: I mean, as main() is supported by all the C compilers. is WinMain()

WinMain() is not standard C, nor is the Windows API. However, it is a "de facto" standard, meaning that all Windows compilers will support it. It doesn't make sense to compile Windows code for example in Linux, so portability beyond Windows compilers is usually not an issue.

: Q: How, such a division of 32 bit or 16 bit compiler is made.

I'm not sure if I understand what you mean. This is dependant on the CPU itself. 32 bit means 32 bit data bus, ie the CPU can munch and process chunks of 32 bit data at a time. The address bus of the CPU is usually (but not always) of the same size as the data bus.

A C programmer usually doesn't have to consider this, the compiler will have to do the adaption to the CPU hardware.

So 16/32 has actually nothing to do with the API to the OS, but it happend to turn out that way on Microsoft operative systems. PC computers running on DOS were designed for 16-bit CPUs, while Windows 95 and later supported 32-bit CPUs.

: is there any 64 bit compiler also...?

I don't know if there is one yet, but there will surely be in the future.

: I am Highly confused about the compilers....to learn C/C++...what : type of Programming I need to learn

It depends on what kind of programming you want to do. There are roughly these branches of work:

WinMain() is not standard C, nor is the Windows API. However, it is a "de facto" standard, meaning that all Windows compilers will support it. It doesn't make sense to compile Windows code for example in Linux, so portability beyond Windows compilers is usually not an issue.

->I understand, now what about functions of 'graphics.h'. Is graphics.h or functins declared in it are standard C?

It depends on what kind of programming you want to do. There are roughly these branches of work:

If I am right....- Windows programs / desktop programming / databases. ->this can be done over VC++, Turbo C++ 2006.?- Web programming + databases. ->For web programming, we generally use HTML, XML, css, xslt....what is the role of C there?- 3D graphics ->for this graphics.h for dos mode, and programs under WInmain() or windows programming might be used?- Embedded telecom / consumer electronics - Embedded real time systems ->for these two tech I am having no idea?...clear the role of C here?.plz

I used the torrentreactor.net for that task.When I started my search for charles petzold over Google.I found, a torrent for it. I downloaded the bit torrent and the torrent for that that book. and finally I am having a 11mb zipped Charles Petzold.

Now I don't know that, it is legal or not.

I wanted to read that book and now I am having the pdf of that.

Please reply for my such deed.

And also tell me the answer my last Question about graphics.h..?I am giving first prefrence to this Q:

Those aren't programming languages. Web programming is PHP, ASP, Javascript, CGI, etc etc. No my cup of tea, so I can't give any details. All relational databases use SQL, which is a script language used to retrieve data from databases.

: - 3D graphics: ->for this graphics.h for dos mode, and programs under WInmain() or windows programming might be used?

Windows programming certainly helps, but 3D graphics are almost exclusively done with either OpenGL or DirectX. These are libraries that a Windows compiler can use.

: - Embedded telecom / consumer electronics : - Embedded real time systems : ->for these two tech I am having no idea?...clear the role of C : here?.plz

The telecom stuff, such as mobile phones and mp3 players tend to use Java, they have no real safety or performance issues in those applications so that language works well. All other modern embedded apps almost exclusively use C, C++ and assembler. There is yet no other language that is efficient enough to be used in realtime systems.

C is preferred before assembler, since portable code is very important in embedded systems. C is also much more widely used than C++, roughly because

1) In cases the programmer is clueless about the underlying instructions caused by his code, C is faster than C++. (If you knew how many incompetent programmers there are in the world, you would never travel by car or airplane again :-)).

2) The lack of C++ compilers that fully conform with the standard.

3) All problems and issues with the C language are well-known, since the language has been around for so long.