Thread: How do i assign values to ponter char array????

  1. #1
    Registered User
    Join Date
    Aug 2013
    Posts
    2

    How do i assign values to ponter char array????

    I can assign values to pointer character array like this...

    Code:
    char *array[4]={"abc","xyz","dgf","sdt"}
    ;

    but the case is i don't know how to assign strings through key board ???? with using gets ,getchar or other suitable function

    please help me someone !!!!
    Thank you!

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    I wrote an example and saved it here for reuse purposes.

    I have used fgets, since in the link provided you can also see, why gets is really bad to use.

    // Welcome to the forum!
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  3. #3
    Registered User
    Join Date
    Aug 2013
    Posts
    2

    Thank you very much !!!

    Thank you very much for your help!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How do I assign values to elements of a 2D array?
    By Karyumi in forum C Programming
    Replies: 9
    Last Post: 06-21-2012, 02:48 PM
  2. Assign values to array of structures
    By rlesko in forum C++ Programming
    Replies: 8
    Last Post: 12-12-2010, 03:31 PM
  3. Assign values to a set of array of structures
    By glucosonte in forum C Programming
    Replies: 1
    Last Post: 08-26-2009, 08:10 AM
  4. Assign an arrays values to another array
    By laczfinador in forum C Programming
    Replies: 3
    Last Post: 05-06-2009, 07:46 AM
  5. 3-d array assign string values
    By WaterNut in forum C++ Programming
    Replies: 8
    Last Post: 07-01-2004, 12:02 AM