CrazyEngineers
  • problem in c..

    anksingla

    Member

    Updated: Oct 22, 2024
    Views: 1.1K
    int s[][2]={12,1,13,214,3};

    int i,j;
    int (*p)[2];
    int *pint;
    For(i=0;i<3;++i)
    {
    p=&s;
    pint=(int*)p;
    for(j=0;j<2;++j)
    printf("%d",*(pint+j));
    }
    This will print values stored in array s.
    But in printf statement instead of *(pint+j) if use *(*p+j). Both will print values of s.
    How *(pint+j)=*(*p+j)??
    Can anyone explain it..?
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • avii

    MemberOct 3, 2014

    <a href="https://www.eskimo.com/~scs/cclass/notes/sx10a.html" target="_blank" rel="nofollow noopener noreferrer">10.1 Basic Pointer Operations</a>
    Are you sure? This action cannot be undone.
    Cancel
  • Shashank Moghe

    MemberOct 3, 2014

    Explicit typecasting, I believe? The question to follow is, whether it is necessary.
    Are you sure? This action cannot be undone.
    Cancel
  • anksingla

    MemberOct 3, 2014

    Shashank Moghe
    Explicit typecasting, I believe? The question to follow is, whether it is necessary.
    i also think so..but in a below program i got confused..
    int s[4][2]
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register