C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-22-2009, 12:00 PM   #1
Registered User
 
Join Date: Nov 2009
Posts: 1
Lightbulb cprogramming

hello everyone....
sorry, i have a question ?
is it possible to declare a variable in types of string ? if it is then , how??
thank you!
hello everyone is offline   Reply With Quote
Old 11-22-2009, 12:02 PM   #2
Epy
Hen-teaser
 
Epy's Avatar
 
Join Date: Sep 2009
Location: Ohio
Posts: 434
char something[] = "hello!"
__________________
-Jake
http://thatcadguy.blogspot.com/

Last edited by Epy; 11-22-2009 at 12:04 PM. Reason: brainfart
Epy is offline   Reply With Quote
Old 11-22-2009, 04:24 PM   #3
Registered User
 
Join Date: Nov 2009
Posts: 43
or
char *s = "hui";
r00t is offline   Reply With Quote
Old 11-22-2009, 05:23 PM   #4
Registered User
 
Join Date: Apr 2006
Posts: 1,337
Quote:
Originally Posted by r00t View Post
or
char *s = "hui";
No don't do that. That's only possible for backwards compatibility. Instead do this:

Code:
const char *s="can't change me";
__________________
It is too clear and so it is hard to see.
A dunce once searched for fire with a lighted lantern.
Had he known what fire was,
He could have cooked his rice much sooner.
King Mir is offline   Reply With Quote
Old 11-23-2009, 07:24 AM   #5
Registered User
 
Join Date: Jul 2008
Posts: 95
Try this:
Code:
char string[4];
strcpy(string, "This is King Arthur");
Maybe you will learn something.
valthyx is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about Cprogramming abachler General Discussions 2 04-10-2008 09:34 AM
Wikipedia CProgramming Entry? jverkoey General Discussions 9 07-27-2005 09:15 PM
#cprogramming Dual-Catfish A Brief History of Cprogramming.com 8 05-04-2002 09:37 PM
David's CProgramming Theorem DavidP A Brief History of Cprogramming.com 10 08-14-2001 12:29 AM


All times are GMT -6. The time now is 02:08 AM.


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