Thread: cprogramming

  1. #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!

  2. #2
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    char something[] = "hello!"
    Last edited by Epy; 11-22-2009 at 12:04 PM. Reason: brainfart

  3. #3
    Registered User
    Join Date
    Nov 2009
    Posts
    46
    or
    char *s = "hui";

  4. #4
    Registered User
    Join Date
    Apr 2006
    Posts
    2,149
    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.

  5. #5
    1337
    Join Date
    Jul 2008
    Posts
    135
    Try this:
    Code:
    char string[4];
    strcpy(string, "This is King Arthur");
    Maybe you will learn something.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question about Cprogramming
    By abachler in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 04-10-2008, 09:34 AM
  2. Wikipedia CProgramming Entry?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 07-27-2005, 09:15 PM
  3. #cprogramming
    By Dual-Catfish in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 05-04-2002, 09:37 PM
  4. David's CProgramming Theorem
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 08-14-2001, 12:29 AM