#include <stdio.h>
#include <string.h>
int lookup_keyword(const char*key, const char* table[], const int size)
{
int ret = -1;
int i = 0;
for(i=0; i<size; i++)
{
if (strcmp(key, table[i]) == 0)
{
ret = i;
break;
}
}
return ret;
}
#define DIM(array) (sizeof(array)/sizeof(*array))
int main()
{
const char* keyword[] = {
"do",
"for",
"if",
"register",
"switch",
"while",
"case",
"static",
};
printf("%d\n", lookup_keyword("static", keyword, DIM(keyword)));
return 0;
}
#include <stdio.h>
int main()
{
int i;
int* pI = &i; //普通类型
typedef int(AINT5)[5];
AINT5* p1;
int array[5];
p1 = &array; //数组指针1
int (*p2)[5] = &array; //数组指针2(不建议这样写)
int (*p3)[4] = &array; // X 数组指针3(不建议这样写)
return 0;
}
typedef int* pInt; pInt a[4];
#include <iostream>
using namespace std;
int main()
{
int c[4]={1,2,3,4};
int *a[4]; //指针数组
int (*b)[4]; //数组指针
b=&c;
//将数组c中元素赋给数组a
for(int i=0;i<4;i++)
{
a[i]=&c[i];
}
//输出看下结果
cout<<*a[1]<<endl; //输出2就对
cout<<(*b)[2]<<endl; //输出3就对
return 0;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有