LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-09-2010, 02:56 AM   #1
stefanolima
Member
 
Registered: Jul 2008
Location: Dar-es-Salaam
Distribution: Fedora,CentOS,Ubuntu
Posts: 60

Rep: Reputation: 15
Array of words(strings)- please help!


Hi!

I want to create a simple program of arranging words in column. I found that this is like array. I know array of characters whereby you define type as char, whereby array elements are characters, now how to declare array of words so that array elements are words?

thanks
 
Old 07-09-2010, 03:07 AM   #2
dsk
LQ Newbie
 
Registered: Jul 2010
Posts: 4

Rep: Reputation: 0
the c language:


char *string[5];
string[0] = "just a test";
 
Old 07-09-2010, 04:16 AM   #3
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,473

Rep: Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888
Although a nice guess by dsk ... any particular language here?
It does help if you provide the full picture.
 
Old 07-12-2010, 04:01 AM   #4
stefanolima
Member
 
Registered: Jul 2008
Location: Dar-es-Salaam
Distribution: Fedora,CentOS,Ubuntu
Posts: 60

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by dsk View Post
the c language:


char *string[5];
string[0] = "just a test";
Thanks, it worked!

I use c++ tried also
string mystring[10];
mystring[0]="Linux Guru";
 
Old 07-12-2010, 04:15 AM   #5
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,473

Rep: Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888Reputation: 1888
Please mark as SOLVED once you have a solution.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array and check strings mech123 Linux - Newbie 6 05-03-2010 07:48 AM
need help, going mad about array pointers and strings... haydari Programming 1 04-12-2007 06:05 PM
Array of Pointers to C Strings anamericanjoe Programming 7 12-13-2006 06:44 PM
Initializing Array of Strings jrtayloriv Programming 10 02-03-2005 12:22 PM
Join an array of strings with C? notsoevil Programming 3 06-20-2003 10:58 AM


All times are GMT -5. The time now is 07:46 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration