wt is output of s1, &s1

This is a discussion on wt is output of s1, &s1 within the C Programming forums, part of the General Programming Boards category; Code: int main() { struct s { }; struct s s1; printf("%u %u \n",s1,&s1); return 0; } the output of ...

  1. #1
    kotin
    Join Date
    Oct 2009
    Posts
    132

    wt is output of s1, &s1

    Code:
    int main()
    {
    struct s
    {
    };
    struct s s1;
    printf("%u  %u \n",s1,&s1);
    return 0;
    }
    the output of above program giving two different addresses. till now i guessing s1 also return the address of structures.but its not returning the address(&s) of structures.

    can any one give clear explanation on above issue

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Try compiling with warnings on. Nothing there is right. Structures aren't arrays, you can't use the name of the variable as if it were a pointer.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. execl()/fork() output
    By tadams in forum C Programming
    Replies: 19
    Last Post: 02-04-2009, 03:29 PM
  2. Replies: 4
    Last Post: 11-30-2005, 04:44 PM
  3. Formatting output into even columns?
    By Uncle Rico in forum C Programming
    Replies: 2
    Last Post: 08-16-2005, 06:10 PM
  4. Control different DA output value!
    By Hunterhunter in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 03-13-2003, 12:11 PM
  5. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 05:27 AM

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