TkTkorrovi 69

Download mingw at [url][/url]
Install it in the directory \mingw. Add \mingw\bin directory to the path, changing start > settings > control panel > system > advanced > environment variables > local variables > PATH. The paths there are separated by semicolon. start > run > cmd, go to your directory where your file is, and run
gcc yourfile.c -o something.exe
When there are errors, you have to fix them. Finally, when it compiles, run something.exe, that's all :)

But notepad is not good for writing code, the worst is that it doesn't show the line number, and doesn't enable you to go to a certain line number, either. But compiler says the line numbers where the errors are, and this is often the only way how you can find these lines. I think the best advice is, download and install gvim [url][/url], and use it instead of notepad. For simple editing, it's not anyhow different than notepad, only if you remember to press i before you start editing. But later, you would find many things which it can do for you, to make both editing and even compiling your code easier. gvim is a programmers editor and so something the programmers use to edit, programmers don't use notepad ;) One thing which you should remember, is that windows explorer doesn't change the directory in the shell. So that when you are in some directory with windows explorer, and then run the cmd console, you are not in ...

TkTkorrovi 69

I don't know how to explain it the best... Look, there are variables, which in c terms are really called objects. We can consider these objects as folders, which contain something. Folder has two different properties, it usually has a name, and it has its physical location, somewhere on the shelf. Now we can give someone a copy of the folder, in which case he doesn't see the folder itself and may not know anything about the physical location of the folder. Or we can give him access to the folder, in which case he knows its physical location, can change its content, and can also rearrange the folders on the shelf. The folder name is the name of the object (variable), and the physical location of the folder is its reference, which is the value of the pointer (we may consider that the physical location of some folder may be written in another folder, which is pointer). By knowing the physical location of the objects, we can do many things. We may refer to these objects anywhere, giving access to them (enabling others to change them), and we can arrange the objects, physically or logically, any way, the simplest is the array, which in c can always be accessed by pointer (when array is a pointer, then array [n] is always the same as *(array + n)). More complex are the linked lists, binary trees etc, which enable some dynamic arrangement, ie we don't have to change the physical ...

Salem commented: Good link to the Jensen tutorial, which is one of the best +9

TkTkorrovi 69

I included stdlib.h, and my compiler doesn't give any warning, even with all warnings on. Without stdlib h it says "incompatible implicit declaration of built-in function 'malloc'" gcc 4.1.2, debian linux.

Salem commented: Yes +9

TkTkorrovi 69

Indeed it seems that the only thing which standard says concerning the unary ++ and -- operators, is that the value of the operand would be obtained for use in expression, either before (postfix) or after (prefix) applying the operator. What remains unspecified is the order of evaluation of the operands (except precedence) and when the postfix operator would be applied.

Using the gcc compiler, the value was indeed 125, which means that gcc compiler does it the most determined way, ie applies the postfix operators only after evaluating the whole expression.

But using tcc compiler, the result was 144, which means that the postfix operators were applied immediately after obtaining the value of their operand.

Therefore using ++ or -- operators in an expression when their operand would be used later in that same expression, is something which can cause unspecified behaviour, and should therefore be avoided. What is unspecified is when the operator would be applied after obtaining the value of the operand.

Aia commented: Nothing but gcc. +6

TkTkorrovi 69

[QUOTE=Ancient Dragon;406981]Those are fighting-words Mr. :)[/QUOTE]

No, these are the words of good advice, and only intended as such. I care about developers, and about the users, but i don't care about the companies. Please don't interpret it so that not caring about the companies is always fighting against them, this is the same as demanding a full compliance.

You obviously have no clue what you are talking about. Win32 api in Vista is the same as previous versions of MS-Windows -- only [b]enhanced[/b] and some additions.

I don't quite agree, but even if there are only some enhancements and additions, then they are quite substantial, and profoundly change the way the api is used. But "only some" is not a minutia in programming, as i still remember the "small changes" from windows 98 to 2000, like some small changes of default fonts and how the fonts were measured, this made my programs written for windows 98, look like a complete mess in windows 2000.

iamthwee commented: Damn right, tell it like is! +11
Aia commented: For caring. +6

TkTkorrovi 69

C wiki, with a lot of resources [url][/url]

~s.o.s~ commented: Excellent. +29

TkTkorrovi 69

What do you mean by graphics? If you want to write some games, you should use either opengl for 3d or sdl for 2d (both cross-platform). But if you want edit boxes, menus etc, and 2d graphics also, the best is GTK [url][/url]. Because it's not commercial like qt, and it's for C, using it you'll also understand how to do the object-oriented programming in C (I mean C, not C++). GTK is available for Linux, Windows and Mac OS X. It's the best joice because it is cross-platform, it is not right to choose a library based on Windows API, because Windows API always changes, and one day we may have not Windows, but a new operating systems, so if you want that your programs would work and there would also be any use of your knowledge in the future, write programs which at least can be ported to Linux. GTK can be installed in Windows, and used no matter what compiler you have, but its installation is somewhat complicated, as you have to manually install many components into a directory tree. So in Windows, the best is to use cygwin, which installs everything automatically, just like Linux.

SpS commented: Good ~SpS +3