当前位置:网站首页>Questions d'examen écrit classiques du pointeur
Questions d'examen écrit classiques du pointeur
2022-07-06 05:13:00 【Nuages C】
Catalogue des articles
Question 1 de l'examen écrit
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;
}
//Quels sont les résultats du programme??
Question 2 de l'examen écrit
//La taille de la structure est20Octets
struct Test
{
int Num;
char *pcName;
short sDate;
char cha[2];
short sBa[4];
}*p;
//HypothèsespLa valeur de0x100000. Quelle est la valeur de l'expression du tableau ci - dessous??
int main()
{
printf("%p\n", p + 0x1);
printf("%p\n", (unsigned long)p + 0x1);
printf("%p\n", (unsigned int*)p + 0x1);
return 0;
}
Question 3 de l'examen écrit
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;
}
Question 4 de l'examen écrit
#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;
}
Question 5 de l'examen écrit
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;
}
Question 6 de l'examen écrit
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;
}
Question 7 de l'examen écrit
#include <stdio.h>
int main()
{
char *a[] = {
"work","at","alibaba"};
char**pa = a;
pa++;
printf("%s\n", *pa);
return 0;
}
Question 8 de l'examen écrit
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;
}
边栏推荐
- [NOIP2009 普及组] 分数线划定
- Codeforces Round #804 (Div. 2)
- Microblogging hot search stock selection strategy
- Pix2pix: image to image conversion using conditional countermeasure networks
- Review of double pointer problems
- A little knowledge of CPU, disk and memory
- The IPO of mesk Electronics was terminated: Henan assets, which was once intended to raise 800 million yuan, was a shareholder
- RT thread analysis - object container implementation and function
- Easy to understand I2C protocol
- nacos-高可用seata之TC搭建(02)
猜你喜欢
[mathematical modeling] differential equation -- sustainable development of fishing industry
Modbus protocol communication exception
TCP three handshakes you need to know
The underlying structure of five data types in redis
Cve-2019-11043 (PHP Remote Code Execution Vulnerability)
从0到1建设智能灰度数据体系:以vivo游戏中心为例
flutter 实现一个有加载动画的按钮(loadingButton)
ByteDance program yuan teaches you how to brush algorithm questions: I'm not afraid of the interviewer tearing the code
你需要知道的 TCP 三次握手
Can the feelings of Xi'an version of "Coca Cola" and Bingfeng beverage rush for IPO continue?
随机推荐
ISP learning (2)
驱动开发——HelloWDM驱动
行业专网对比公网,优势在哪儿?能满足什么特定要求?
[数学建模] 微分方程--捕鱼业的持续发展
Codeforces Round #804 (Div. 2)
Acwing week 58
Basic knowledge and examples of binary tree
[buuctf.reverse] 159_ [watevrCTF 2019]Watshell
Three. JS learning - light and shadow (understanding)
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
IPv6 comprehensive experiment
idea一键导包
Request (request object) and response (response object)
Postman assertion
Mongodb basic knowledge summary
Compilation and connection of shader in games202 webgl (learn from)
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
[mathematical modeling] differential equation -- sustainable development of fishing industry
2021robocom robot developer competition (Preliminary)
Using stopwatch to count code time