有以下程序#include <stdio.h>void fun(char **p){ p=p+2; printf("%s\n",*p);}main(){ char *a[]={"Morning","Afternoon","Evening","Night"}; fun(a);}程序的运行结果是A.rningB.afternoonC.ternoon D.Evening
- Arning
- Bafternoon
- Cternoon
- DEvening
有以下程序#include <stdio.h>void fun(char **p){ p=p+2; printf("%s\n",*p);}main(){ char *a[]={"Morning","Afternoon","Evening","Night"}; fun(a);}程序的运行结果是A.rningB.afternoonC.ternoon D.Evening
本题主要考查指向指针的指针。在程序中,首先定义了一个fun函数,函数无返回类型,函数的形参是一个指向指针的指针变量p,在该函数体中,首先将变量p的值加2,并保存在p中,根据指针变量的特性,这个加2是使指针变量往后移两个单位,如果开始指向第一个元素,现在则指向第三个元素(注意:这里并不是指移动两个字节)。然后输出*p,由于p是一个指向指针的变量,那么*p输出的也不是单个数组,而是一个首地址对应的字符串或数组,在本题中输出的是字符串。在主函数中,定义一个指针数组a,并赋初值,然后调用函数fun,实参为a,输出的应该是指针数组中第3个指针对应的字符串,即Evening。
1、有以下程序#include <stdio.h>main() {
有以下程序#include <stdio.h>main() { char b=2; printf("%dn", b=b<<3);}程序的运行结果是A.4 B.8 C.16 D.2000A4 B8 C16 D2000
2、请读程序: #include<stdio.h> void fu
请读程序:#include<stdio.h>void fun(float *pl, float *p2, float *s){ s=( float * )calloc( 1, sizeof(float));*s=*p1+ *(p2++);}main(){ float a[2]={1.1, ...
3、有如下程序段#include "stdio.h"void fun(int *
有如下程序段#include "stdio.h"void fun(int *a,int *b,int *c,int *d,int *e){ int i,j,k,m; for(i=0;i< *a;i++) for(j=0;j< *b;j++) for(k=0;k<*c;k++) ...
4、有以下程序 #include <stdio.h> main()
有以下程序#include <stdio.h>main(){char c1=’1’,c2=’2’;c1=getchar();c2=getchar();putchar(c1);putchar(c2);}当运行时输入:a<回...
5、有以下程序:include<stdio.h>include<
有以下程序:include<stdio.h>include<strin9.h>main( ){printf{"%dn",strlen("%dn",strlen("ATSn012|"));}程序运行后的输出结果是( )。A3B8C4D9
6、有以下程序#include "stdio.h"void fun(int *a
有以下程序#include "stdio.h"void fun(int *a,int *b){ int c=20,d=20; *a=c/3; b=d/5;}main(){ int a=3,b=5; fun(&a,&b); printf("%d,%d\n",a,b);}程序的运行结果是A.6,5 B.5,6C.20,25 D.3,5A6,5 B5,6C20,25 D3,5