1. 0xFF bit5 清0 0x80 bit2 置1
0x01<<4&0xFF 0x01<<1|0x80 |
2. 定义一个整数
Int a; |
定义一个指向整数的指针:
int a = 0;
Int *p = &a;
定义一个指向指针的指针,它指向的指针指向一个整形数
Int* *p = &p1 Int *p1 = &a Int a = 0; |
一个有10个整形数的数组:
Int a[10] = {1,2,3,4,5,6,7,8,9,10} |
一个有10个指针的数组;该指针指向一个整形数:
Int *p[10] |
一个指向有10个整形数数组的指针
Int (*p)[10] |
#include "stdio.h"
int a = 180;
int b;
static char c;
int main(int argc, char *argv[])
{
char d = 4;
static short e;
a++;
c = (char)++a;
e = (++d)++;
printf("a=%d, b=%d, c=%d, d=%d, e=%d",a,b,c,d,e);
return 0;
}
写出程序输出: 182 0 -74 6 5
int main() { int a[10] = {0,1,2,3,4,5,6,7,8,9}; memcpy(a+3, a, 5); for(int i=0; i<10; i++) { printf("%d",a[i]); } return 0; } |
写出 程序输出: 0120123489
5. 对于整形变量A = 0x87654321,请画出 little endian 及 big endian的方式下在内存中是如何存储 的?
6. 请问以下代码有什么问题
int main() { char a; char *str = &a; strcpy(str, "hello"); printf(str); return 0; } |
Str存储的地址不为a不为数组 |
7. 将字符串“helloworld”倒叙编程输出
#include <stdio.h> #include <string.h> int main(int argc, const char *argv[]) { char a[100] = "helloworld"; int i = 0; char c = 0; int j = 0; j=strlen(a)-1; for(i=0,j=strlen(a)-1;i<j;i++,j--) { c = a[j]; a[j] = a[i]; a[i] = c; } printf("%s\n",a); return 0; } |
8. 写一个函数和,可以将CPU占有率保持在100%;
While(1) |
9. 简述linux目录结构中 /usr 、/etc、/dev目录的作用
Etc:特定主机系统范围内的配置文件 Dev:任何设备与接口设备都是以文件形式储存在这个目录的,包括终端设备(tty*)软盘(fd*)硬盘(hd*)RAM(ram*)和CD_ROM(cd*) Usr:默认软件都会存于该目录下,用于存储只读用户的第二层次,包含绝大多数的用户工具和应用程序。 |