当前位置:网站首页>指針經典筆試題
指針經典筆試題
2022-07-06 05:13:00 【雲朵c】
筆試題一
int main()
{
int a[5] = {
1,2,3,4,5 };
int* ptr = (int*)(&a + 1);
printf("%d\n", *(a + 1));
printf("%d\n", *(ptr - 1));
return 0;
}
//程序的結果是什麼?


筆試題二
//結構體的大小是20個字節
struct Test
{
int Num;
char *pcName;
short sDate;
char cha[2];
short sBa[4];
}*p;
//假設p的值為0x100000。 如下錶錶達式的值分別為多少?
int main()
{
printf("%p\n", p + 0x1);
printf("%p\n", (unsigned long)p + 0x1);
printf("%p\n", (unsigned int*)p + 0x1);
return 0;
}


筆試題三
int main()
{
int a[4] = {
1, 2, 3, 4 };
int *ptr1 = (int *)(&a + 1);
int *ptr2 = (int *)((int)a + 1);
printf("%x\n", ptr1[-1]);
printf("%x\n", *ptr2);
return 0;
}


筆試題四
#include <stdio.h>
int main()
{
int a[3][2] = {
(0, 1), (2, 3), (4, 5) };
int *p;
p = a[0];
printf( "%d", p[0]);
return 0;
}


筆試題五
int main()
{
int a[5][5];
int(*p)[4];
p = a;
printf("%p\n", &p[4][2] - &a[4][2]);
printf("%d\n", &p[4][2] - &a[4][2]);
return 0;
}


筆試題六
int main()
{
int aa[2][5] = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int* ptr1 = (int*)(&aa + 1);
int* ptr2 = (int*)(*(aa + 1));
printf("%d\n", *(ptr1 - 1));
printf("%d\n", *(ptr2 - 1));
return 0;
}


筆試題七
#include <stdio.h>
int main()
{
char *a[] = {
"work","at","alibaba"};
char**pa = a;
pa++;
printf("%s\n", *pa);
return 0;
}


筆試題八
int main()
{
char *c[] = {
"ENTER","NEW","POINT","FIRST"};
char**cp[] = {
c+3,c+2,c+1,c};
char***cpp = cp;
printf("%s\n", **++cpp);
printf("%s\n", *--*++cpp+3);
printf("%s\n", *cpp[-2]+3);
printf("%s\n", cpp[-1][-1]+1);
return 0;
}


边栏推荐
- yolov5 tensorrt加速
- 行业专网对比公网,优势在哪儿?能满足什么特定要求?
- Three.js学习-光照和阴影(了解向)
- Rce code and Command Execution Vulnerability
- Postman前置脚本-全局变量和环境变量
- GAMES202-WebGL中shader的編譯和連接(了解向)
- Fiddler installed the certificate, or prompted that the certificate is invalid
- Flink kakfa data read and write to Hudi
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- nacos-高可用seata之TC搭建(02)
猜你喜欢

Postman关联
![[数学建模] 微分方程--捕鱼业的持续发展](/img/7c/2ab6f2a34bc2c97318537ec8e0b0c5.png)
[数学建模] 微分方程--捕鱼业的持续发展

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

Nacos - TC Construction of High available seata (02)
![[mathematical modeling] differential equation -- sustainable development of fishing industry](/img/7c/2ab6f2a34bc2c97318537ec8e0b0c5.png)
[mathematical modeling] differential equation -- sustainable development of fishing industry
![[leetcode] 18. Sum of four numbers](/img/06/c160b47d756290e5474e4c07e68648.png)
[leetcode] 18. Sum of four numbers

Postman manage test cases

Codeforces Round #804 (Div. 2)
![[leetcode daily question] number of enclaves](/img/6e/1da0fa5c7d1489ba555e4791e2ac97.jpg)
[leetcode daily question] number of enclaves

Leetcode dynamic planning day 16
随机推荐
TCP three handshakes you need to know
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Cve-2019-11043 (PHP Remote Code Execution Vulnerability)
Ora-01779: the column corresponding to the non key value saving table cannot be modified
Postman管理测试用例
Mysql高级篇学习总结9:创建索引、删除索引、降序索引、隐藏索引
2021 robocom world robot developer competition - undergraduate group (semi-finals)
Excel转换为Lua的配置文件
Flody的应用
SQL injection vulnerability (MSSQL injection)
Basic knowledge and examples of binary tree
Postman Association
The video in win10 computer system does not display thumbnails
Rce code and Command Execution Vulnerability
The underlying structure of five data types in redis
2021RoboCom机器人开发者大赛(初赛)
MPLS experiment
EditorUtility. The role and application of setdirty in untiy
Compilation and connection of shader in games202 webgl (learn from)