Quote Originally Posted by Dadu@
when code run it gives output 1 6422296 4199048 0 4199157 and I was expecting 1, 2, 3, 4, 5
spvar is a pointer to struct point. Therefore, *spvar is a struct point. So what you're doing here:
Code:
printf( "%d ", *spvar );
is trying to print a struct point object as if it were an integer. It isn't. Your compiler should have warned you about that, and if it didn't, you need to compile at a high warning level and pay attention to warnings.

What you want to do is something like this:
Code:
#include<stdio.h>
#include<stdlib.h>


struct point
{
    int array[5];
};


int main(void)
{
    struct point svar = {{1, 2, 3, 4, 5}};

    for (size_t i = 0; i < 5; i++)
    {
        printf("%d ", svar.array[i]);
    }
    printf("\n");

    return 0;
}