SA-MP Forums Archive
C code evaluation - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: C code evaluation (/showthread.php?tid=465186)



C code evaluation - Misiur - 21.09.2013

Hi guys! I know that this isn't C coding forums, but I've seen that there are few fluent C(++) programmers around here. I've only just finished K&R book, and my knowledge of C was more about finding vulnerabilities in code than building something working.

http://pastebin.com/vKetGzCk

I'd like you to tell me if I've commited any major mistakes, and how's my coding style. Additionally I have a question about unions. I thought that it simply pointed to one of specified variables, and that you didn't have to care later which one you are using, like in my code:

Код:
//instead of 
singleItem.chosenItem.PersonItem.name
//use
singleItem.chosenItem.name
which would point at either PersonItem.name, or CompanyItem.name. How to achieve somthing similar?