Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wrapping Code 2

Status
Not open for further replies.

vivasuzi

Programmer
Jun 14, 2002
183
I have an array -->

char TaskID = array['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];

I think there's a way so I can write it on multiple lines so that my code is easier to read -->

char TaskId = array['A','B','C','D','E','F','G','H','I','J','K'
'L','M','N','O','P','Q','R','S','T','U','V'
'W','X','Y','Z']

but how do you do this? The array is gonna be 70 chars and I don't want it to be one long line of code. Thanx *Suzanne*
 
There's no reason why you can't do it as in your example:

char TaskId = array['A','B','C','D','E','F','G','H','I','J','K',
'L','M','N','O','P','Q','R','S','T','U','V',
'W','X','Y','Z'];

separate elements of the array can be on different lines so the code is more readable, the compiler just looks for the semicolon(;) to use as a statement separator. Just because the code spans more than one line, doesn't mean it's interpreted as more than one statement.

If you want to do this with strings, that's a different story - but you can use the backslah(\) to tell the compiler to "join" the string spanning more than one line:

strMyString = "this is a very long stringso long that it's split into two lines";

hope this helps

CMR
 
okay thanx. I just forgot to put a common at the end of the line after the K and V. Thanx for your help :) When you haven't written it a language in a while everything seems so hard! *Suzanne*
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top