Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,855 questions

51,776 answers

573 users

How to use anonymous struct in C

1 Answer

0 votes
#include <stdio.h>

struct Test
{
    struct
    {
        char ch;
        int n;
    };
};
 
int main()
{
    struct Test t;
    
    t.ch = 'z';
    t.n = 998;
 
    printf("t.ch = %c  t.n = %d\n", t.ch, t.n);
 
    return 0;
}


/*
run:

t.ch = z  t.n = 998

*/

 



answered Mar 17, 2018 by avibootz

Related questions

1 answer 68 views
68 views asked Nov 22, 2024 by avibootz
1 answer 148 views
148 views asked Dec 27, 2020 by avibootz
1 answer 175 views
1 answer 127 views
127 views asked Mar 17, 2018 by avibootz
1 answer 200 views
1 answer 159 views
159 views asked Mar 17, 2018 by avibootz
1 answer 136 views
136 views asked Mar 17, 2018 by avibootz
...