Learning C
If you don't know C and plan to use it for osdeving, it might be profitable to begin with some C language exercises.
A good start (you still need to find tutorials, these are just exercises):
- program that writes a string, asks for your name, writes two line breaks and writes another string and the provided name;
- implement strcopy(), strncopy(), strncmp() and other string manipulation functions. What is a buffer overflow?
- implement memmove() or memcpy(). Can you do it with inline assembly so it be faster?
- use inline assembly to perform CPUID and interpret the results;
- use typedefs to name uint32 for a 32-bit unsigned integer type; what type is signed 16-bit?
- use structs and pointers to implement a singly linked lists.
- divide the program with singly linked lists to main.c, list.c and list.h. What is a header guard?
- learn about inline, static, volatile; ternary operator; casts;
- use C preprocessor to write MAX, MIN macros; to print out the current function name, line number;
- use C preprocessor to write a log function which takes a
level for the first argument, and uses printf() on the rest of the
arguments if the level is higher or equal to current logging threshold.
原文地址:http://wiki.osdev.org/C#Learning_C
阅读(946) | 评论(0) | 转发(0) |