当前位置:网站首页>指針經典筆試題
指針經典筆試題
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;
}


边栏推荐
- Codeforces Round #804 (Div. 2)
- ORM aggregate query and native database operation
- Postman test report
- The web project imported the MySQL driver jar package but failed to load it into the driver
- Drive development - the first helloddk
- GAMES202-WebGL中shader的编译和连接(了解向)
- 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
- Leetcode dynamic planning day 16
- idea一键导包
- [lgr-109] Luogu may race II & windy round 6
猜你喜欢

Yyds dry inventory SSH Remote Connection introduction
![[mathematical modeling] differential equation -- sustainable development of fishing industry](/img/7c/2ab6f2a34bc2c97318537ec8e0b0c5.png)
[mathematical modeling] differential equation -- sustainable development of fishing industry

Zynq learning notes (3) - partial reconfiguration
![[lgr-109] Luogu may race II & windy round 6](/img/fe/d5b67c7dff759c519a04da023630ea.png)
[lgr-109] Luogu may race II & windy round 6

SQL injection vulnerability (MSSQL injection)

F12 solve the problem that web pages cannot be copied

Golang -- TCP implements concurrency (server and client)

Huawei equipment is configured with OSPF and BFD linkage

Class inheritance in yyds dry inventory C
![[数学建模] 微分方程--捕鱼业的持续发展](/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
Three.js学习-光照和阴影(了解向)
ORM aggregate query and native database operation
yolov5 tensorrt加速
Zynq learning notes (3) - partial reconfiguration
Flink kakfa data read and write to Hudi
[leetcode] 18. Sum of four numbers
Steady, 35K, byte business data analysis post
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
Postman pre script - global variables and environment variables
Knowledge points of circular structure
从0到1建设智能灰度数据体系:以vivo游戏中心为例
C AES encrypts strings
Nacos TC setup of highly available Seata (02)
【LeetCode】18、四数之和
Class inheritance in yyds dry inventory C
[mathematical modeling] differential equation -- sustainable development of fishing industry
CUDA11.1在线安装
你需要知道的 TCP 三次握手
Fiddler installed the certificate, or prompted that the certificate is invalid