array problem

Discussion in 'C Programming' started by voklta7, Oct 28, 2014.

  1. voklta7

    voklta7

    Joined:
    Oct 28, 2014
    Messages:
    1
    Likes Received:
    0
    The following piece of code is valid in c :

    Code (Text):
    #include <stdio.h>

    int main(int argc, const char * argv[])
    {
        int array1 = {1,2,3,4,5};
        int array2[] = {1,2,3,4,5};
        int array3[5] = {1,2,3,4,5};
    }
    I know array1 is a single int and array2 and array3 are actual arrays , but what is the use of statement

    Code (Text):
    int array1 = {1,2,3,4,5};

    why is it valid ? whats the use ?
     
    voklta7, Oct 28, 2014
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.