help a newbee

This is a discussion on help a newbee within the C Programming forums, part of the General Programming Boards category; hi iam new at programming and i am not sure what this statement means. i have read the book but ...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    62

    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
    Code:
            for(i=0; i<5; i++)  
           (k[i]=3+i);
            j =*(k+2);
            printf("%d %d\n", k[2],j);

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,262
    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
    Location
    US of A
    Posts
    305
    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, 01: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, 11:40 AM
  4. Newbee
    By Bio Hazord in forum C++ Programming
    Replies: 2
    Last Post: 10-22-2003, 08:08 PM
  5. Newbee question
    By d00-asu in forum Windows Programming
    Replies: 4
    Last Post: 08-31-2001, 04:32 AM

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