Posts Tagged ‘strings’

Part 2: C Programming Tutorial 3- Strings and Char Data Type in C: Game Programming Series

This is part II of a two part video.

The C Programming language is a great place to start for anyone who would like to learn computer programming. C is relatively easy to learn but can be very powerful While its a much older language and not object oriented, it can be used to develop almost any type of application– including video games. The C programming language has been used in colleges and universities for years and continues to be used all over the world.

This series will continue through the basics of C programming and teach C for the creation of simple video games. The Gameboy Advance platform will be used later in the course.

To do this tutorial yourself you’ll need to download a C compiler and editor. LearnToProgram.TV recommends Dev C++ by Bloodshed.

This third C Programming Tutorial Video will show you how to use the char data type, get input from the user and use strings. In addition two string functions are discussed.

Mark Lassoff, of LearnToProgram.TV hosts the program. Lassoff is a professional programming trainer and has been in the field for ten years. For more information and videos, please visit www.LearnToProgram.TV.

Duration : 0:6:54

Read the rest of this entry »

Technorati Tags: , , , , , ,

C Programming Tutorial 3- Strings and Char Data Type in C: Game Programming Series: Part 1

This is part I of a two part video.

The C Programming language is a great place to start for anyone who would like to learn computer programming. C is relatively easy to learn but can be very powerful While its a much older language and not object oriented, it can be used to develop almost any type of application– including video games. The C programming language has been used in colleges and universities for years and continues to be used all over the world.

This series will continue through the basics of C programming and teach C for the creation of simple video games. The Gameboy Advance platform will be used later in the course.

To do this tutorial yourself you’ll need to download a C compiler and editor. LearnToProgram.TV recommends Dev C++ by Bloodshed.

This third C Programming Tutorial Video will show you how to use the char data type, get input from the user and use strings. In addition two string functions are discussed.

Mark Lassoff, of LearnToProgram.TV hosts the program. Lassoff is a professional programming trainer and has been in the field for ten years. For more information and videos, please visit www.LearnToProgram.TV.

Duration : 0:9:20

Read the rest of this entry »

Technorati Tags: , , , , , ,

Extending C: “Variable Variables” like PHP $$var

Tiny C library for a limited amount of dynamic strings. If you need more functionality, feel free to extend it, write your own linked lists or check out GTK’s glib GList object.

Examples:

if(dictionary(“moo”))
strcpy(dictionary(“moo”),”Something about cows.”);
puts(dictionary(“moo”));//prints Something about cows.
dictionary(“destroy()”);

Limitations:
1. Size of strings in this demo are limited to 99 characters (see CHARS in source code).

2. 100 bytes of memory (99 + the terminating NULL) are set aside for each and every word it does not find, so you can add definitions to them. This makes it very friendly and easy to use, but it may not be a good idea to use it in situations where you are looking up a lot of words that are not in the dictionary!

3. Uses fast linear searching, but for a very large dictionary you might want to use something else, the aforementioned GList or a database.

4. You are responsible for freeing the memory used by the dictionary upon program termination. You can do that using the _destroy method:
dictionary_destroy()

Or by passing “destroy()” as a string to the dictionary object directly, vis:
dictionary(“destroy()”);

5. (updated) Like malloc, this library now returns NULL when out of memory. You may desire to check for this.

6. Slightly obfuscated code for compactness. If you don’t like the formatting, run the free “indent” program (available for linux and windows) on it or use your text editor’s automatic indent feature.

The tiny dictionary library and demonstration program may be downloaded from my web site:
http://www.thenerdshow.com/index.php?page=dictionary

Duration : 0:6:49

Read the rest of this entry »

Technorati Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , ,