Tutorial

This is a discussion on Tutorial within the C Programming forums, part of the General Programming Boards category; I was learning from the tutorial and noticed something wrong in this line: Code: printf( "Your name is %d, letters ...

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    19

    Tutorial

    I was learning from the tutorial and noticed something wrong in this line:

    Code:
    printf( "Your name is %d, letters long", strlen ( name ) );
    If u leave it like that I get When i enter my name as William or any name it says:

    Code:
    Your name is 8, letters longEnter Your Last Name:
    Shouldnt there be a \n after long? So it goes to a new line?

    If so please get creator of tutorial to fix this to help the further learners of C who use this site to do the right thing.

    P.S Iam learning myself and just noticed this.

  2. #2
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    Yes, that should be "Your name is %d, letters long\n"

    Or maybe correct grammar could be used: "Your name is %d letters long.\n"

    Or maybe a space instead of a newline: "Your name is %d letters long. "

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    9
    exactly.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My new website
    By joeprogrammer in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 03-17-2006, 07:38 PM
  2. Cprog tutorial: Design Patterns
    By maes in forum C++ Programming
    Replies: 7
    Last Post: 10-11-2004, 02:41 AM
  3. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  4. Problem with tutorial (Vector class)
    By OdyTHeBear in forum C++ Programming
    Replies: 4
    Last Post: 12-18-2002, 02:49 PM
  5. My DirectInput tutorial....
    By jdinger in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 06-19-2002, 12:32 AM

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