Thread: help a newbee

  1. #1
    Registered User
    Join Date
    Feb 2008

    Thumbs up help a newbee

    hi iam new at programming and i am not sure what this statement means. i have read the book but iam still not sure will anyone let me know what this means please. i know what the loop means but iam not sure aobut the rest
            for(i=0; i<5; i++)  
            j =*(k+2);
            printf("%d %d\n", k[2],j);

  2. #2
    Registered User
    Join Date
    Sep 2004
    The for loop will call the statement below it 5 times with i being equal to 0, 1, 2, 3, and 4. The array k will have each of those indexes set to the value of 3+i.

    After the for loop is done, the variable j will be set to *(k+2) which is the same as saying k[2]. Finally it prints out k[2] and j.

    You really need to read a good programming book.
    bit∙hub [bit-huhb] n. A source and destination for information.

  3. #3
    Registered User
    Join Date
    Jun 2009
    US of A
    Also read this

    C Board - Announcements in Forum : C Programming

    Use sensible titles. It freaks out people with these titles :-)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbee: Define a struct with scoop outside file?
    By Marcux in forum C Programming
    Replies: 2
    Last Post: 07-18-2007, 12:46 PM
  2. Linux newbee
    By geek@02 in forum Linux Programming
    Replies: 8
    Last Post: 11-09-2004, 12:02 AM
  3. Help with variables (newbee)
    By stugatza in forum C Programming
    Replies: 7
    Last Post: 08-18-2004, 10:40 AM
  4. Newbee
    By Bio Hazord in forum C++ Programming
    Replies: 2
    Last Post: 10-22-2003, 07:08 PM
  5. Newbee question
    By d00-asu in forum Windows Programming
    Replies: 4
    Last Post: 08-31-2001, 03:32 AM