c doubt

This is a discussion on c doubt within the C Programming forums, part of the General Programming Boards category; how do I accomplish this "abc.i" where i should vary from 1 to n where abc is string...

  1. #1
    cbankgoesblank
    Guest

    c doubt

    how do I accomplish this
    "abc.i"

    where i should vary from 1 to n

    where abc is string

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    moving to the c forum...

    take a string, create another string from an integer (look into standard functions to learn how to do this, or create your own), and concatenate the two strings.

  3. #3
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    Originally posted by ygfperson
    moving to the c forum...

    take a string, create another string from an integer (look into standard functions to learn how to do this, or create your own), and concatenate the two strings.
    i disagree. sprintf() is easier to use and more flexible imo
    hello, internet!

  4. #4
    cbankgoesblank
    Guest
    could u please write the entire code for the program

  5. #5
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    Originally posted by cbankgoesblank
    could u please write the entire code for the program
    no.
    hello, internet!

  6. #6
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    Originally posted by moi
    i disagree. sprintf() is easier to use and more flexible imo
    doh... i always forget about sprintf...

  7. #7
    cbankgoesblank
    Guest

    C doubt

    We have a string abc and integer i
    the function needs the follwing argument

    ie "abc.i"
    here i should vary between 1 and n
    the problem is
    when i say this

    . is a char
    in abc.i

    for(i=1;i<n;i++)
    funct("abc.i")

    the value of i doesnt vary from 1 to n
    please write the command
    which will help me do this
    for this particular problem
    not in general

  8. #8
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946

    Re: C doubt

    Originally posted by cbankgoesblank
    We have a string abc and integer i
    the function needs the follwing argument

    ie "abc.i"
    here i should vary between 1 and n
    the problem is
    when i say this

    . is a char
    in abc.i

    for(i=1;i<n;i++)
    funct("abc.i")

    the value of i doesnt vary from 1 to n
    please write the command
    which will help me do this
    for this particular problem
    not in general
    did you consult your standard library's documentation on sprintf() yet?
    hello, internet!

  9. #9
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Read the second post on this thread.

    Then start reading some of the other threads in this forum, I've just supplied an example program that does what you ask. At least show you're making an effort, then people will be more willing to help you.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  10. #10
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    When posting, please keep in mind the principles that follow. If a post blatantly violates these guidelines, the post will be removed. The board is here to help you; the guidelines will help you get answers more quickly.

    Don't expect someone to write your entire program
    Read these rules again, i'm not saying this to be an ass but they demonstrate things you need to follow to learn to be something in this language. If someone does it for you and you don't logically think it through, not only are you not learning, but your missing the 50% of the programming thats the most fun: thinking it up!

    Program on dude.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Doubt in pointer.
    By shwetha_siddu in forum C Programming
    Replies: 5
    Last Post: 03-21-2009, 02:28 AM
  2. doubt in c parser coding
    By akshara.sinha in forum C Programming
    Replies: 4
    Last Post: 12-23-2007, 01:49 PM
  3. Replies: 4
    Last Post: 12-10-2006, 07:08 PM
  4. Doubt abt Storage!
    By kalamram in forum C Programming
    Replies: 1
    Last Post: 04-21-2006, 06:30 AM
  5. Greatest C++ Doubt
    By vasanth in forum C++ Programming
    Replies: 15
    Last Post: 02-28-2002, 04:41 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21