随笔分类 - 代码
摘要:线程有四种状态:新生状态、可运行状态、被阻塞状态、死亡状态。 多线程的几种实现方法 继承 Thread 类 实现 Runnable 接口再 new Thread #include <stdio.h> #include <pthread.h> #include <Windows.h> static i
阅读全文
摘要:int b = 0x1; printf("%x\n", b | 0x3); //01 | 11 = 11 位运算或 //01 & 11 = 01 位运算与,有0为0,全1为1
阅读全文
摘要:int* test(int a, char b) { printf("%d\n", a); } void test1(int a) { printf("%d\n", a * a); } void test2(int a) { printf("%d\n", a * 5); } int main() {
阅读全文
摘要:class Test { public: char *a; Test() { this->a = (char *)malloc(10);//this->a表示对象自身的成员a strcpy_s(this->a, 10, "hello"); printf("Test init\n"); } ~Test
阅读全文