how to name an array? and call an array?

This is a discussion on how to name an array? and call an array? within the C Programming forums, part of the General Programming Boards category; Well, how to actually tis array Code: for(x=0;x<6;x++){ for(y=0;y<6;y++){ printf(" # "); } } i want to call tis array ...

  1. #1
    Registered User l2krence's Avatar
    Join Date
    Nov 2010
    Posts
    24

    Post how to name an array? and call an array?

    Well, how to actually tis array
    Code:
    for(x=0;x<6;x++){
       for(y=0;y<6;y++){
       printf(" # ");
       }
    }
    i want to call tis array to like having (array) and set it's position of [0][0] to be a certain value.

    so how to call tis array and set it to like ,,, (array)[0][0] = '!';

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,631
    What array are you talking about?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by l2krence View Post
    Well, how to actually tis array
    Code:
    for(x=0;x<6;x++){
       for(y=0;y<6;y++){
       printf(" # ");
       }
    }
    i want to call tis array to like having (array) and set it's position of [0][0] to be a certain value.

    so how to call tis array and set it to like ,,, (array)[0][0] = '!';
    You answered your question right in your own question...

    Code:
    int array[6][6];
    
    for(x=0;x<6;x++){
       for(y=0;y<6;y++){
          array[x][y] = 0;
          printf(" %d ",array[x][y]);
         }
    }
    just like you said...

  4. #4
    Chi! whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    8,189
    There is a class of pointer types where the grouping is significant.

    For example:
    Code:
    int array[12]
    int (*ptr)[12] = &array;
    Sometimes wrapping things in parentheses means nothing and at other times it is all the difference in type. Careful, there.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Troubleshooting Input Function
    By SiliconHobo in forum C Programming
    Replies: 14
    Last Post: 12-05-2007, 06:18 AM
  2. copy array of classes or explicity call constructor
    By Doodle77 in forum C++ Programming
    Replies: 5
    Last Post: 06-10-2007, 11:57 AM
  3. Replies: 6
    Last Post: 11-09-2006, 02:28 AM
  4. 1-D array
    By jack999 in forum C++ Programming
    Replies: 24
    Last Post: 05-12-2006, 07:01 PM
  5. Dynamic Array of Object Fucntion call.
    By Spitball04 in forum C++ Programming
    Replies: 5
    Last Post: 09-15-2004, 10:40 AM

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