![]() |
Lets All Learn C!!!!!!
I wrote this for a group of linux wannabe programmers. Ya'll might have use for it too. Since you all look like wannabes.
If it makes no sense, just tell me what you don't get, and I'll try explaining it. Or just PM me or something. Firstly, Why learn C? C allows a great deal of control over the computer system it is running on, as well as being capable of running on any OS, from Windows to Linux, and on nearly any system, PDA to supercomputer. But what is C? C is a programming language, much like java or basic. It is basically a set of instructions that the computer has to follow, allowing you to make it perform tasks. C originated several decades ago, and has come to be used by the vast majority of programmers due to its level of control, and it's efficient management of resources. C is an example of a compiled language, meaning that after your program is written in a simple text editor, it must be turned into an executable file (.sh or .exe) by another program called a C Compiler. You can get a free c compiler from the DJGPP project. The simplest program. Open vim or your text editor of choice (Notepad for you Windows buffs). Type in the following: Code:
#include <stdio.h> #include <stdio.h>: This is the standard I/O library used in computing. It allows text to be displayed on screen, and receive input from the keyboard. C has quite a few libraries available, making various processes even simpler for you to use in your programs. int main(): This is a function. main is the name of the function, while int is declaring that a new function is about to start. All C programs must have a function named main, as it's the first function to be run when your program is started. printf: This command tells the program to write to the standard output, which in this case is the screen. The section in the quotes is the format string, which shows how the data will be formatted when displayed. The \n signifies a carriage return, meaning that the program will start a new line. return 0: Sends an error code of 0 back to the program. 0 represents no error. Now to compile our program. Browse to the directory that you saved test.c into using command prompt. To compile, type the following: Code:
gcc test.c -o test.exe If all goes well when you run your program it should display the text 'Hello World!' before exiting. More to come... |
Wrong forum. Moved.
|
Why not C++? C lets you get away with too much. Default function prototypes? Default variable types? Set a non-const pointer to the value of a pointer to const?
|
We can't have that!
What the fuck did you just say? |
Plus MJ already made a C Tutorial thread. He alaborated a lot more me thinks.
|
Quote:
|
#include <stdio.h>
class Anman { public: Anman() { ShutsUp(true); }; ~Anman() {}; void WhatIsAnmanDoing(); private: boolean ShutsUp; }; void Anman::WhatIsAnmanDoing(){ if(ShutsUp) printf("He finally shut up!\n"); } int main(){ Amnan idiot; idiot.WhatIsAnmanDoing(); return 0; } |
DAMIT! THIS WAS SUPPOSE TO SPAM !!!! I HATE YOU ALL!!! *runs knife through each rib rivet*
|
Anman, what distro are you running?
|
Quote:
Quote:
Quote:
|
All times are GMT -6. The time now is 12:56 AM. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.