当前位置:网站首页>指针经典笔试题
指针经典笔试题
2022-07-06 05:12: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;
}
边栏推荐
- Quelques conseils communs sur l'inspecteur de l'unit é, généralement pour les extensions d'éditeur ou d'autres
- Why does MySQL need two-phase commit
- Implementing fuzzy query with dataframe
- Compilation and connection of shader in games202 webgl (learn from)
- 从0到1建设智能灰度数据体系:以vivo游戏中心为例
- 【OSPF 和 ISIS 在多路访问网络中对掩码的要求】
- Zynq learning notes (3) - partial reconfiguration
- Three. JS learning - light and shadow (understanding)
- [classic example] binary tree recursive structure classic topic collection @ binary tree
- Vite configures the development environment and production environment
猜你喜欢
TCP three handshakes you need to know
Compilation et connexion de shader dans games202 - webgl (comprendre la direction)
Golang -- TCP implements concurrency (server and client)
Postman Association
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
Summary of redis basic knowledge points
RTP gb28181 document testing tool
从0到1建设智能灰度数据体系:以vivo游戏中心为例
Principle and performance analysis of lepton lossless compression
随机推荐
Basic knowledge and examples of binary tree
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
Tetris
关于es8316的音频爆破音的解决
The web project imported the MySQL driver jar package but failed to load it into the driver
Mysql高级篇学习总结9:创建索引、删除索引、降序索引、隐藏索引
图论的扩展
Vite configures the development environment and production environment
你需要知道的 TCP 三次握手
JS quick start (II)
ISP learning (2)
Driver development - hellowdm driver
Configuration file converted from Excel to Lua
Postman Association
集合详解之 Collection + 面试题
[buuctf.reverse] 159_ [watevrCTF 2019]Watshell
Ora-01779: the column corresponding to the non key value saving table cannot be modified
Weng Kai C language third week 3.1 punch in
The underlying structure of five data types in redis
Implementing fuzzy query with dataframe