C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 08-15-2007, 11:00 PM   #1
Dr Dipshi++
 
mike_g's Avatar
 
Join Date: Oct 2006
Location: On me hyperplane
Posts: 1,219
Initialzing a 2D character array

I'm writing a function that draws fonts from a binary mask. I havent got very far as I can't remember how to initialize a 2d character array.

heres what i got:
Code:
char mini_text[10][7]="]fjjjr]", "0", "0", "0", "0", "0", "0", "0", "0";
Theres basically 10 array elements for characters 0 to 9, and each characters consists of 7 other characters each representing a scanline. How can I initialize this?
mike_g is offline   Reply With Quote
Old 08-15-2007, 11:03 PM   #2
Woof, woof!
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Australia
Posts: 3,295
hint: { and }

eg,
Code:
char mini_text[10][7] = {"]fjjjr]", "0", "0", "0", "0", "0", "0", "0", "0"};
But perhaps a bitset is better? Eg an array of bitted chars (you have only 7 characters, which would fit into a int8 (char)...).
__________________
"I.T. gets the chicky-babes" - M. Kelly
bakefile | vim
zacs7 is offline   Reply With Quote
Old 08-15-2007, 11:14 PM   #3
Dr Dipshi++
 
mike_g's Avatar
 
Join Date: Oct 2006
Location: On me hyperplane
Posts: 1,219
Cheers. That was a bit of a dumb mistake.

Quote:
But perhaps a bitset is better? Eg an array of bitted chars (you have only 7 characters, which would fit into a int8 (char)...).
I dont quite get what you mean here. I guess I could code it using 5 characters instead of 7 reading the binary patterns vertically instead, but that seems like more hassle than its worth for just shaving a couple of characters off.
mike_g is offline   Reply With Quote
Old 08-16-2007, 02:05 AM   #4
Woof, woof!
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Australia
Posts: 3,295
Never mind, it wasn't really efficient after all or even relevant, my bad
__________________
"I.T. gets the chicky-babes" - M. Kelly
bakefile | vim
zacs7 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2D array of threads? shorinhio C Programming 2 01-04-2007 04:02 PM
Dictionary into a 2d Char Array... Problems. Muzzaro C Programming 10 12-02-2006 12:34 PM
passing/pointing to a 2d array jamie85 C Programming 7 10-28-2005 10:16 PM
Please Help - Problem with Compilers toonlover C++ Programming 5 07-23-2005 10:03 AM
Help with 2-D character array choykawairicky C++ Programming 2 05-15-2004 12:12 AM


All times are GMT -6. The time now is 11:39 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22