Thread: functions gets into char array

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    2

    functions gets into char array

    stuck in a program that asks to do the following any help would be greatly appeciated

    write a program that inputs a line of text with function gets into char array s[ 100 ]. Output the line in uppercase letters and lowercase letters.

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    You'll need to #include <stdio.h> to use gets().

    Seriously, do you try to do anything on your own? There's a big announcement right at the top of this forum about homework questions.

    http://cboard.cprogramming.com/annou...ouncementid=39
    If you understand what you're doing, you're not learning anything.

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    get your flame suit itsme86

    For the love of all that is good in the world don't ues gets(). use fgets(). Please the children of the world beg you!

    Oh sure edit your post while I compose mine. Meanie!

  4. #4
    Registered User
    Join Date
    Apr 2005
    Posts
    2
    nevermind the help... sorry to bother

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > You'll need to #include <stdio.h> to use gets().
    *weeps*
    *looks at the post count - nearly 1000*
    *sobs*
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    He was asking for "any help." I didn't feel like getting into the whole "gets() is dangerous" discussion since it was obvious he was just looking for a free ride.

    But YES! I know gets() is dangerous and I never use it. Okay?
    If you understand what you're doing, you're not learning anything.

  7. #7
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    i think i have the gets() avatar right? i'll post now then. it seems appropriate.
    hello, internet!

  8. #8
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    Quote Originally Posted by Salem
    > You'll need to #include <stdio.h> to use gets().
    *weeps*
    *looks at the post count - nearly 1000*
    *sobs*
    If only there was some way other than post count to judge someone's reputation. Like if someone suggested gets() all the time, they'd be identified with a bright red box. Hmmm, I wonder if there's anything like that?

    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  9. #9
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    I wasn't suggesting gets(). The OP said the requirement was to use gets() so I was being pseudo-helpful by telling the OP to #include <stdio> in order to use it. I'd never suggest gets(). In fact, if you do a search on the board you'll see I've suggested against using gets() several times.
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  2. Need help understanding info in a header file
    By hicpics in forum C Programming
    Replies: 8
    Last Post: 12-02-2005, 12:36 PM
  3. How do i un-SHA1 hash something..
    By willc0de4food in forum C Programming
    Replies: 4
    Last Post: 09-14-2005, 05:59 AM
  4. Passing pointers between functions
    By heygirls_uk in forum C Programming
    Replies: 5
    Last Post: 01-09-2004, 06:58 PM
  5. help with array of char and char **
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 04-20-2002, 02:23 PM