进程是计算机分配资源的最小单位,线程是计算机调度的最小单位
https://www.cnblogs.com/linuxAndMcu/p/10105755.html
这个讲得好 还讲了strlen和 sizeof的区别
32和64位编译器区别: 除了*与long随操作系统子长变化而变化外,其他的都固定不变(32位和64相比)
32: sizeof(*)=4 sizeof(long)=4
64: sizeof(*)=8 sizeof(long)=8
32 位编译器(计算机)的字长为 32 位,所以遵循 4 字节对齐;
64 位编译器的字长为 64 位,所以遵循 8 字节对齐。
strlen 与 sizeof()的区别
short f();
printf("%d\n", sizeof(f()));
输出的结果是sizeof(short),即2。
char str[20]="0123456789";
int a=strlen(str); //a=10;
int b=sizeof(str); //而b=20;
这个不懂
#include <iostream>
using namespace std;
int main()
{
int a[] = { 2, 4, 6, 8, 10 }, *p, **k;
p = a;
k = &p;
printf("%d\n",*(p++));
printf("%d\n",**k);
system("pause");
return 0;
}
这个查不到答案 暂时就这样把
满了或者为0
#define MIN(A,B) ( (A) > (B) ? (B) : (A) )
delete [ ]p;
8
现实中,某些基于RISC(精简指令集)的cpu比如SPARC、PowerPC等,采用Big Endian,而Intel系列cpu采用Little Endian。如果想要知道自己的电脑是什么存储格式只需要输入以下代码:
大端模式和字符串的存储模式类似
#include<iostream>
using namespace std;
void main()
{
char ch[]={0x12,0x34,0x56,0x78}; //从低地址到高地址
int* p=(int*)ch;
cout<<hex<<*p<<endl;//如果是78563412,说明是 Little Endian,如果是12345678,则是Big Endian
}
hex的作用是可以用来进行十六进制流输出比如
using namespace std;
int main(void){
int n = 255;
cout << n << endl; //输出十进制 255
cout << std::hex << n << endl;//输出十六进制FF
system("PAUSE");
return 0;
}