有以下程序: include main( ) {char s[ ] ="159" , * p;p=s;printf( "% c", * p + +有以下程序: #include <stdio.h> main( ) { char s[ ] ="159" , * p; p=s; printf( "% c", * p + + ); printf("%~", * p++);}程序运行后的输出结果是( )。A.15B.16C.12D.59

题目
有以下程序: include main( ) {char s[ ] ="159" , * p;p=s;printf( "% c", * p + +

有以下程序: #include <stdio.h> main( ) { char s[ ] ="159" , * p; p=s; printf( "% c", * p + + ); printf("%~", * p++);}程序运行后的输出结果是( )。

A.15

B.16

C.12

D.59


相似考题
更多“有以下程序: #include <stdio.h> main( ) {char s[ ] ="159" , * p;p=s;printf( "% c", * p + + ”相关问题
  • 第1题:

    请读程序: includef(char * s){cahr * p=s;while(* p!='\0')p++;return(p-s);}main(){

    请读程序: # include<stdio.h> f(char * s) {cahr * p=s; while(* p!='\0')p++; return(p-s); } main() {printf("%d\n”,f("ABCDEF"));} 上面程序的输出结果是 ( )

    A.3

    B.6

    C.8

    D.0


    正确答案:B

  • 第2题:

    有以下程序: include include void f(char * s,char*t){char k; k=*s;*s=*

    有以下程序: #include <stdio.h>#include <string.h>void f(char * s,char*t){ char k; k=*s; *s=*t; *t=k; s++; t--; if( * s) f(s,t);}main( ){ char str[10] :"abedefg", * p; p = str + strlen(str)/2+1; f(p,p -2); printf( "% s \n" ,str);程序运行后的输出结果是( )。

    A.abcdefg

    B.gfedcba

    C.gbcdefa

    D.abedcfg


    正确答案:B
    解析:本程序的作用是将字符串str倒序。语句p=str+strlen(str)/2+1;将指针变量p指向字符'e'所在的存储单元,P-2指向字符,'c'所在的存储单元,在函数f中将这两个存储单元的内容交换,然后将f函数中指向字符'e'的指针变量s加1,指向字符'c'的指针变量t减1,继续将s和t指向的存储单元的内容进行交换,直到s指向的存储单元的内容为空为止。所以本题程序输出的结果是字符串"abcdefe”的倒序形式"gfedcba"。

  • 第3题:

    21、以下程序执行后的结果为 。 #include "stdio.h" #include <string.h> void fun(char *s) { char a[10]; strcpy(a,"string"); s=a; } main() { char *p="gao"; fun(p); printf("%s\n",p); }

    A.gao

    B.结果不确定

    C.str

    D.string


    emoclew emoclew

  • 第4题:

    以下程序运行后,输出结果是()includess(char*s){char*p=s; while(*p)p++ return(p-s);

    以下程序运行后,输出结果是( ) #include<stdio.h> ss(char *s) { char*p=s; while(*p) p++ return(p-s); } main() { char *a="abded" int i; i=ss(a) ; printf("%d\n",i); }

    A.8

    B.7

    C.6

    D.5


    正确答案:D

  • 第5题:

    有以下程序: include main( ) { char *p ,* q; p=(char * )malloc(sizeof(char

    有以下程序: #include<stdlib.h> main( ) { char *p ,* q; p=(char * )malloc(sizeof(char) * 20);q=p; scanf("%s%s",p,q); printf("%s%s\n",p,q); } 若从键盘输入:abc def<回车>,则输出结果是

    A.def def

    B.abc def

    C.abc d

    D.d d


    正确答案:A