Thread: How to print strings on the same line without moving to the next line

  1. #1
    Registered User
    Join Date
    Nov 2011
    Location
    Buea, Cameroon
    Posts
    197

    How to print strings on the same line without moving to the next line

    Hey guys just working up for the google coding contest to start soon and have been practising some of the test questions however i make correct algorithms but my output is rejected because of the fact that my strings are printed on a new line so i wish to know a method to print strings using a printf statement or any other function on the same line

    Thanks in advance

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,478
    Easy, don't print a new line character. Try something like:
    Code:
    printf("Hello ");
    printf("World");
    Jim

  3. #3
    Registered User
    Join Date
    Nov 2011
    Location
    Buea, Cameroon
    Posts
    197
    yeah jumbleberg i'm looking at a similar question on stackoverflow and they recommend what you and also to use strcpy to append the strings together before printing .. thanks let me see how it works.

  4. #4
    young grasshopper jwroblewski44's Avatar
    Join Date
    May 2012
    Location
    Where the sidewalk ends
    Posts
    294
    Fun fun, thanks for pointing me towards the Google Codejam.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to open files and print line by line in shell
    By omega666 in forum Linux Programming
    Replies: 4
    Last Post: 04-15-2011, 04:54 PM
  2. Replies: 7
    Last Post: 12-13-2010, 02:13 PM
  3. Read strings line by line until Ctrl+C is pressed
    By r00t in forum C Programming
    Replies: 25
    Last Post: 11-17-2009, 04:18 AM
  4. moving up a line or more
    By alexnb185 in forum C Programming
    Replies: 3
    Last Post: 08-19-2007, 03:24 PM
  5. print line by line from a file
    By SoFarAway in forum C Programming
    Replies: 3
    Last Post: 02-18-2005, 01:36 PM