Thread: C Question

  1. #1
    Registered User
    Join Date
    Aug 2010
    Location
    india
    Posts
    1

    Exclamation C Question

    I am unable to interpret the reason behind the answer of following question::
    can u plesae help me??


    void main()
    {
    printf(5+"good morning");
    }



    output::::
    morning

  2. #2
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    Look into pointer arithmetic.

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    1
    I'm trying to make the algorhtym and C language to find the first word of a string which the word is limited by a space
    any idea?

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Welcome to the forum, Rahulshrirs and Theo!

    The strtok() function (include string.h for string functions), is made for this. It's a bit complicated, because on your FIRST call to strtok(), you need to include the name of the string (or a pointer to it's address). However, on subsequent calls, you replace that name, with NULL, and that tells the strtok() function to continue from where it left off, in the same char array. You need that so it works easily with loops.

    I'm sure if you search the forum for strtok(), you'll find many examples (the FAQ should have something, as well).

    Let us know if you get stumped, but give it a good go.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question bout my work
    By SirTalksAlots in forum C Programming
    Replies: 4
    Last Post: 07-18-2010, 03:23 PM
  2. A question about a question
    By hausburn in forum C++ Programming
    Replies: 3
    Last Post: 04-25-2010, 05:24 AM
  3. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  4. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  5. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM

Tags for this Thread