From: Valdis.Kletnieks@vt.edu (Valdis.Kletnieks at vt.edu) Date: Sun, 26 Apr 2015 22:22:35 -0400 Subject: Structure declaration without its members variables In-Reply-To: Your message of "Mon, 27 Apr 2015 00:16:59 +0530." <553d3569.2a83460a.02d1.26e2@mx.google.com> References: <553d3569.2a83460a.02d1.26e2@mx.google.com> Message-ID: <156015.1430101355@turing-police.cc.vt.edu> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Mon, 27 Apr 2015 00:16:59 +0530, harshkdev said: > struct kvm; > struct kvm_vcpu; > > Generally we declare structure and its member at same place. It's a forward declaration. Consider two structures that have pointers to each other: struct a { int b, c, d; struct *b b_ptr; } struct b { int foo, bar, baz; struct *a a_ptr; } Now, the struct *b in the first structure won't compile because it hasn't seen b yet. So we stick a 'struct b;' in front both of them so struct a can compile successfully. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 848 bytes Desc: not available Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150426/def821f9/attachment.bin