当前位置:网站首页>指針經典筆試題
指針經典筆試題
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;
}
边栏推荐
- Fluent implements a loadingbutton with loading animation
- MySQL time processing
- Weng Kai C language third week 3.1 punch in
- Raspberry pie 3.5-inch white screen display connection
- Talking about the type and function of lens filter
- [buuctf.reverse] 159_[watevrCTF 2019]Watshell
- Chip debugging of es8316 of imx8mp
- The underlying structure of five data types in redis
- Summary of three log knowledge points of MySQL
- [leetcode daily question] number of enclaves
猜你喜欢
Extension of graph theory
[untitled]
The underlying structure of five data types in redis
Fuzzy -- basic application method of AFL
Crazy God said redis notes
Fluent implements a loadingbutton with loading animation
Three methods of Oracle two table Association update
Easy to understand I2C protocol
Figure database ongdb release v-1.0.3
Leetcode dynamic planning day 16
随机推荐
關於Unity Inspector上的一些常用技巧,一般用於編輯器擴展或者其他
JS quick start (II)
Extension of graph theory
ByteDance program yuan teaches you how to brush algorithm questions: I'm not afraid of the interviewer tearing the code
Ad20 is set with through-hole direct connection copper sheet, and the bonding pad is cross connected
关于es8316的音频爆破音的解决
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 daily question] number of enclaves
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
nacos-高可用seata之TC搭建(02)
The underlying structure of five data types in redis
RT thread analysis log system RT_ Kprintf analysis
ISP learning (2)
麥斯克電子IPO被終止:曾擬募資8億 河南資產是股東
EditorUtility. The role and application of setdirty in untiy
饼干(考试版)
SQL injection vulnerability (MSSQL injection)
Ora-01779: the column corresponding to the non key value saving table cannot be modified
[mask requirements of OSPF and Isis in multi access network]