TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JONATHAN DE BOYNE POLLARD
from: THOMAS HABETS
date: 1998-02-05 11:54:00
subject: converting char to string

 JdBP>>>         char str[2] = { ch } ;
 TH>> Not at initilation time, at runtime
 JdBP> I don't understand your objection.
I have a (good IMO) habit of declaring all my variables that will be used in 
the entire function in the beginning. Just like C force you too (yes I do 
know about {} but let's just ignore that for a sec).
So I don't do this:
    char ch;
    ... lots and lots of code altering ch ...
    char str[2] = {ch};
I put the char str[] declaration up with char ch.
Nicer IMO.
I program mostly C so it's better in all ways.
I see initilation of vars as an init thing,  which makes it easier to read 
(again: IMO).
 JdBP> My only guess is that you aren't familiar with this particular part of 
the C++ language,
No, this one time I am correct! Dammit! :-)
---
---------------
* Origin: Q U A K E 2 ! ! ! ! ! ! ! ! (2:201/293.22)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.