当前位置:网站首页>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;
}
边栏推荐
- CUDA11.1在线安装
- Application of Flody
- Zynq learning notes (3) - partial reconfiguration
- Oracle query table index, unique constraint, field
- Nestjs配置文件上传, 配置中间件以及管道的使用
- 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
- Vite configures the development environment and production environment
- Three.js学习-光照和阴影(了解向)
- IPv6 comprehensive experiment
- Easy to understand I2C protocol
猜你喜欢
February 12 relativelayout
Postman前置脚本-全局变量和环境变量
Microblogging hot search stock selection strategy
Codeforces Round #804 (Div. 2)
Weng Kai C language third week 3.1 punch in
Imperial cms7.5 imitation "D9 download station" software application download website source code
Easy to understand I2C protocol
Extension of graph theory
Yolov5 tensorrt acceleration
Simple understanding of interpreters and compilers
随机推荐
Talking about the type and function of lens filter
Force buckle 1189 Maximum number of "balloons"
The video in win10 computer system does not display thumbnails
Configuration file converted from Excel to Lua
集合详解之 Map + 面试题
2021 robocom world robot developer competition - undergraduate group (semi-finals)
Postman test report
Principle and performance analysis of lepton lossless compression
Postman前置脚本-全局变量和环境变量
组播和广播的知识点梳理
[leetcode daily question] number of enclaves
Fluent implements a loadingbutton with loading animation
Orm-f & Q object
Nestjs配置文件上传, 配置中间件以及管道的使用
The underlying structure of five data types in redis
Pagoda configuration mongodb
RT thread analysis - object container implementation and function
Request (request object) and response (response object)
图论的扩展
RT thread analysis log system RT_ Kprintf analysis