Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
And they lived happily ever after. The End. What's this? You say something's still not clear about this whole C programming language thing? Well, to be quite honest, I'm not even sure what the above code does. It's a snippet from one of the entires in the 2001 International Obfuscated C Code Contest 1, a wonderful competition wherein the entrants attempt to write the most unreadable C code possible, with often surprising results. The bad news is that if you're a beginner in this whole thing, all C code you see looks obfuscated! The good news is, it's not going to. | Beej s Guide to C Programming Brian Beej Hall beej@beej.us Revision alpha-25 May 17 2007 Copyright 2007 Brian Beej Hall Contents 1. Foreward.1 1.1. Audience 1 1.2. Platform and Compiler 1 1.3. Building under Unix 2 1.4. Official Homepage 2 1.5. Email Policy 2 1.6. Mirroring 2 1.7. Note for Translators 3 1.8. Copyright and Distribution 3 2. Programming Building Blocks.4 2.1. The Specification 4 2.2. The Implementation 5 2.3. So Much To Do So Little Time 6 2.4. Hello World 7 3. Variables Expressions and Statements Oh My .10 3.1. Variables 10 3.2. Operators 11 3.3. Expressions 12 3.4. Statements 12 4. Building Blocks Revisited.17 5. Functions.18 5.1. Passing by Value 20 5.2. Function Prototypes 20 6. Variables The Sequel.22 6.1. Up Scope 22 6.2. Storage Classes 24 7. Pointers--Cower In Fear .26 7.1. Memory and Variables 26 7.2. Pointer Types 27 7.3. Dereferencing 28 7.4. Passing Pointers as Parameters 28 8. Structures.30 8.1. Pointers to structs 31 8.2. Passing struct pointers to functions 32 9. Arrays.34 9.1. Passing arrays to functions 35 ii Contents 10. Strings.38 11. Dynamic Memory.40 11.1. malloc 40 11.2. free 41 11.3. realloc 41 11.4. calloc 43 12. More Stuff .44 12.1. Pointer Arithmetic 44 12.2. typedef 45 12.3. enum 46 12.4. More struct declarations 47 12.5. Command Line Arguments 48 12.6. Multidimensional Arrays 50 12.7. Casting and promotion 51 12.8. Incomplete types 52 12.9. void pointers 53 12.10. NULL pointers 54 12.11. More Static 55 12.12. Typical Multifile Projects 56 12.13. The Almighty C Preprocessor 58 12.14. Pointers to pointers 61 12.15. Pointers to Functions 63 12.16. Variable Argument Lists 65 13. Standard I O Library.69 13.1. fopen 71 13.2. freopen 73 13.3. fclose 75 13.4. printf fprintf 76 13.5. scanf fscanf 81 13.6. gets fgets 84 13.7. getc fgetc getchar 86 13.8. puts fputs 88 13.9. putc fputc putchar 89 13.10. fseek rewind 90 13.11. ftell 92 13.12. fgetpos fsetpos 93 13.13. ungetc 94 13.14. fread 96 13.15. fwrite 98 13.16. feof ferror .