当前位置:网站首页>C language pointer practice questions
C language pointer practice questions
2022-08-10 01:48:00 【BSP Junior Primary School Monk】
1. Use the pointer method to calculate the sum of the corresponding positions of each element in the two arrays, and store the result of the sum in the third array, and then output.
#include void count(int *p1,int *p2,int *p3,int x);int main(){int arr01[4]={2,4,5,8};int arr02[4]={1,0,4,6};int arr03[4];count(arr01,arr02,arr03,4);}void count(int *p1,int *p2,int *p3,int x){int i;for(i=0;i
Run result:
2. Using the pointer, output the alphabet in sequence, and then output in reverse order.
#include #include int main(){char *p01=(char *) malloc(sizeof(char)*26);char *p02=(char *) malloc(sizeof(char)*26);int i;printf("Output in uppercase alphabetical order:\n");for(i=0;i<26;i++){*(p01+i)=('A'+i);printf("%c ",*(p01+i));}printf("\n\n");printf("Output in lowercase alphabetical order:\n");for(i=0;i<26;i++){*(p02+i)=('a'+i);printf("%c ",*(p02+i));}printf("\n\n");printf("Reverse uppercase letters:\n");for(i=25;i>=0;i--){printf("%c ",*(p01+i));}printf("\n\n");printf("Reverse lowercase output:\n");for(i=25;i>=0;i--){printf("%c ",*(p02+i));}return 0;}
Run result:
边栏推荐
- Penetration Testing and Offensive and Defense Confrontation - Vulnerability Scanning & Logic Vulnerability (Part1)
- Kubernetes YAML编写 讲解
- Mysql数据库 ALTER 基本操作
- Win7怎么把控制面板添加到右键菜单
- Kubernetes服务接入Istio
- Why don't suggest you run in Docker Mysql?
- 天猫全网商品详情封装接口
- Solidity 智能合约入门
- C语言学习之旅 【操作符(残缺版)】
- CAS:851113-28-5 (Biotin-ahx-ahx-tyramine)
猜你喜欢
线程的同步与互斥
LSTM-based distributed energy generation prediction (Matlab code implementation)
pytest:如何在测试中编写和报告断言
[SUCTF 2019]CheckIn (.htaccess和.user.ini)
由生物素参与的D-Biotinol,CAS号:53906-36-8具体特性说明
365天挑战LeetCode1000题——Day 052 逐步求和得到正数的最小值 贪心
Redis 非关系型数据库学习(一) ---- Redis 的安装
基于FPGA的任意字节数的串口接收(含源码工程)
技术分享 | 接口自动化测试如何处理 Header cookie
【毕业设计】 基于Stm32的家庭智能监控系统 - 单片机 图像识别 人体检测 AI
随机推荐
《痞子衡嵌入式半月刊》 第 60 期
西安生物素-四聚乙二醇-酰胺-4苯酚 浅黄色半固态
服装店管理系统如何推送活动?
C语言--数据的存储(上)
What do you know about FITC-labeled biotin (FITC-biotin|CAS: 134759-22-1)?
Tensor flow 踩坑记
Docker 面试题2则--取数据库连接数和docker-compose
-采花生-
Creo5.0入门教程赠素材
flask——请求、响应、请求扩展、session、闪现、蓝图、g对象、flask-session
const修饰指针的三种情况
Redis 大 key 要如何处理?
Project (7) - PolarSeg point cloud semantic segmentation
Leetcode83. 删除排序链表中的重复元素
3.9 - 正规表达式和正规集 3.10 - 有限自动机
基于FPGA的任意字节数的串口接收(含源码工程)
快速响应性智能型/智能响应性聚乙二醇纳米/还原响应型水凝胶的研究与制备
R语言使用coxph函数构建生存分析回归模型,使用forestmodel包的forest_model函数可视化生存回归模型对应的森林图
Kubernetes 开发环境比对
《MySQL入门很轻松》第4章:数据表中存放的数据类型