C Programming #2 - Sample Programs

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
29,951
Loading...
Alert icon
Sign in or sign up now!
Alert icon
Ratings have been disabled for this video.

Uploaded by on Jan 1, 2007

Some small programs you can test if would like to program with the C computer programming language.


Here is a program called welcome.c that will display some text on the screen. You can modify it to display any text you want. Note, comments for your personal programming use are placed between: /* and */. They often are used to describe a portion of code as a reference if you need it later. The text between the comment symbols/syntax will be skipped over by the compiler/computer.

/* welcome.c Jan 1, 2007
This program will display some text on the screen.
*/

#include "stdio.h"

void main(void)
{

printf("Welcome");

return;
}


Here is a program that will sound a beep, that can perhaps be used to signal an event, etc.

/* beep.c
Jan 2, 2007
This program will sound a beep alert sound.
Use more \a characters to lengthen the sound.
*/

#include "stdio.h" /* automatically include the code of stdio.h that contains the code of the functions that are used to display text */

void main(void)
{

printf("\a");

return;
}

To compile the c source program to an .EXE file/program, you would type in something like
the following on the command line:

tcc welcome.c or:
tcc Cprograms\welcome.c

The output should be a file called: welcome.exe
Windows will automatically create an icon for you, so that you can click on it and execute/run the program in a graphical manner, rather than a text/console/command-line manner.

---------------------------------------------

TCC can also be used to create some Windows. TCC included an example that creates a window
and displays some text:

tcc examples\hello_win.c

Windows programming will not be covered in any detail here, but will give some links where you can start. Some will be batch files, some will be command line commands (essentially DOS), and some will be for Windows.

http://en.wikipedia.org/wiki/Kernel32.dll
http://en.wikibooks.org/wiki/Basic_Computing_Using_Windows
http://en.wikipedia.org/wiki/Batch_file
http://en.wikibooks.org/wiki/Programming:C
http://en.wikibooks.org/wiki/C%2B%2B_Programming
http://en.wikipedia.org/wiki/Cmd.exe
http://en.wikipedia.org/wiki/Command_line_interface
http://en.wikipedia.org/wiki/Comparison_of_computer_shells
http://msdn2.microsoft.com/en-us/library/ms682087.aspx
http://johnbokma.com/windows/command-prompt-shortcut.html
http://en.wikipedia.org/wiki/DOSBox
http://en.wikipedia.org/wiki/Kernel_%28computer_science%29
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-u...
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-u...
http://www.mingw.org/
http://www.mingw.org/download.shtml
http://en.wikipedia.org/wiki/MS-DOS
http://www.adsciengineering.com/tools/nowindow/
http://en.wikipedia.org/wiki/Shell_%28computing%29
http://www.ecma-international.org/publications/standards/Ecma-234.htm
http://en.wikipedia.org/wiki/System_console
http://www.gdargaud.net/Humor/C_Prog_Debug.html
http://blogs.msdn.com/oldnewthing/
http://blogs.msdn.com/
http://en.wikibooks.org/wiki/Wikibooks:Computer_science_bookshelf
http://en.wikipedia.org/wiki/Win32_console
http://en.wikipedia.org/wiki/Windows_api
http://msdn2.microsoft.com/en-us/library/aa383750.aspx
http://en.wikibooks.org/wiki/Programming:Windows_Programming

Category:

Howto & Style

Tags:

License:

Standard YouTube License

All Comments

Adding comments has been disabled for this video.
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more