填空题

mystrlen函数的功能是计算str所指字符串的长度,并作为函数值返回。请填空。 int mystrlen(char*str) {int i for(i=0;______!=’\0’;i++); return(i);}

【参考答案】

*(str+i或str[i]
<上一题 目录 下一题>
热门 试题

填空题
以下程序中函数f的功能是在数组x的n个数(假定n个数互不相同)中找出最大最小数,将其中最小的数与第一个数对换,把最大的数与最后一个数对换。请填空。#include <stdio.h>voidf(int x[],int n){int p0,p1,i,j,t,m;i=j=x[0]; p0=p1=0;for(m=0;m<n;m++){if(x[m]>i {i=x[m];p0=m;}else if(x[m]<j {j=x[m];p1:m;}}t=x[p0];x[p0]=x[n-1];x[n-1)=tt=x[p1];x[p1]= [12] ; [13] =t;}main(){ int a[10],u;for(u=0;u<10;u++) scanf( %d ,&a[u]);f(a,10);for(u=0;u<10;u++) printf( %d ,a[u]);printf( n );}
填空题
阅读下列程序,则程序的输出结果为______。#include stdio.h struct ty{ int data;char c;};main(){ struct ty a={30,’x’};fun(a);printf( %d%c ,a.data,a.c);}fun(struct ty b){ b.data=20;b.c=’y’;}
相关试题
  • 有以下程序段,且变量已正确定义和赋值for...
  • 下列选项中错误的说明语句是
  • 在深度为5的满二叉树中,叶子结点的个数为
  • 以下不是面向对象思想中的主要特征的是
  • 数据库系统的核心是