1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

getting string of given length

Discussion in 'C' started by thanuja m, Dec 20, 2010.

  1. thanuja m

    thanuja m New Member

    Joined:
    Dec 20, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    If we give string length as input,the output must be the string of given length,can u help me in developing this program
     
  2. imported_viswanathan

    imported_viswanathan New Member

    Joined:
    Dec 22, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    if you have any doubt drop me a mail or call me
    char *s =" Viswanathan";
    int position =5; // you need the string of 5 character

    //solution
    s[position] = '\0';
    printf("%s",s);

    Regards,
    Viswanathan
    09865650093
    rviswawt@gmail.com
     
  3. raji.vunnam

    raji.vunnam New Member

    Joined:
    Jan 6, 2011
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    good idea

    we can also print using a loop kada................
     
  4. umartayyabkhan

    umartayyabkhan New Member

    Joined:
    Jan 21, 2011
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Electrical Engineering Student
    Location:
    Peshawar
    Home Page:
    Just show me the output of the program u want and then i will try to make it okey!
     

Share This Page