Thread: unions

  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    50

    unions

    Code:
    main()
    {
    union u
    {
    struct s{int a;int b}n;
    struct ss{int c;long d}ni;
    
    
    }uu;
    uu.ni.c=1;
    uu.ni.d=0;
    
    
    
    
       printf("%d %d",(uu.n.a),(uu.n.b));
    }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unions in C
    By Saurabh Mehta in forum C Programming
    Replies: 12
    Last Post: 11-20-2012, 10:15 AM
  2. unions
    By jduke44 in forum C Programming
    Replies: 2
    Last Post: 10-26-2005, 03:50 PM
  3. Unions?
    By Sure in forum C Programming
    Replies: 8
    Last Post: 06-30-2005, 02:47 AM
  4. Unions in c++
    By The Gweech in forum C++ Programming
    Replies: 5
    Last Post: 08-06-2002, 08:14 AM
  5. Unions?
    By hostensteffa in forum C++ Programming
    Replies: 3
    Last Post: 06-08-2002, 06:01 AM

Tags for this Thread