Thread: Help! very simple i think

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    1

    Help! very simple i think

    hey everbody, i have just stared c programming as part of my university course, and i am trying to store text that a user inputs, i store it as "char" type and when i try to display the text later it only shows the first letter???

    thanks

  2. #2
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    You'll need to look into arrays. What you'd want would be something like:

    char somename[50];

    Which would give you a string that could have a length of 49 chars in it. Later, you'll learn about dynamic memory and be able to store several MB worth of text via the use of malloc().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. creating very simple text editor using c
    By if13121 in forum C Programming
    Replies: 9
    Last Post: 10-19-2010, 05:26 PM
  2. Simple message encryption
    By Vicious in forum C++ Programming
    Replies: 10
    Last Post: 11-07-2004, 11:48 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Simple simple program
    By Ryback in forum C++ Programming
    Replies: 10
    Last Post: 09-09-2004, 05:48 AM
  5. Need help with simple DAQ program
    By canada-paul in forum C++ Programming
    Replies: 12
    Last Post: 03-15-2002, 08:52 AM