阅读下面程序: include void funl(char a,char b) { char c; c=a;a=b;b=C; } void f 阅读下面程序:include<iostream.h>void funl(char a,char b){char c;c=a;a=b;b=C;}void fun2(char a,char b){char c;c=a;a=b;b=c;}void fun3(char a,char b){char c;c=a;a=b;b=C;}void main(){char a,b;a='A';b='B';funl(a,b);cout<<a<<b;a='A';b='B';fun2(a,b);cout<<a<<b;a='A';b='B';fun3(a,b);cout<<a<<b;}则该程序的输出为【 】。
阅读下面程序: include void funl(char a,char b) { char c; c=a;a=b;b=C; } void f
阅读下面程序:
include<iostream.h>
void funl(char a,char b)
{
char c;
c=a;a=b;b=C;
}
void fun2(char &a,char b)
{
char c;
c=a;a=b;b=c;
}
void fun3(char &a,char &b)
{
char c;
c=a;a=b;b=C;
}
void main()
{
char a,b;
a='A';b='B';
funl(a,b);cout<<a<<b;
a='A';b='B';
fun2(a,b);cout<<a<<b;
a='A';b='B';
fun3(a,b);cout<<a<<b;
}
则该程序的输出为【 】。
相关考题:
设有以下函数void fun(int n,char * s) { …… }则下面对函数指针的定义和赋值均是正确的是A)void (*pf)(); pf=fun;B)viod *pf(); pf=fun;C)void *pf(); *pf=fun;D)void (*pf)(int,char);pf=fun;
下面程序的结果是()。includevoid main(){char *str;str="test!";cout 下面程序的结果是( )。#include<iostream.h>void main(){char *str;str="test!";cout<<str[5];}A.程序错误B.!C.'\0'D.为空字符
下列程序的运行结果是______。include class Base { public: void f(int x){cout 下列程序的运行结果是______。include<iostream.h>class Base{public:void f(int x){cout<<“Base:”<<x<<endl;});class Derived:public Base{public:void f(char*str){cout<<“Derived:”<<str<<endl;}};void main(void){Base*pd=ne
设有以下函数: void fun(int n,char*s){…} 则下面对函数指针的定义和赋值均正确的是( )。A.void(*pf)( );pf=fun;B.void*pf( );pf=funC.void*pf( );*pf=fun;D.void(*pf)(int,char);pf=fun;
设有以下函数:void fun(int n,char*$s){……}则下面对函数指针的定义和赋值均正确的是A.void(*pf)( );pf=fun;B.void*Pf( );pf=fun;C.void*pf( ); *pf=fun;D.void(*pf)(int,char);nf=fun;
char*getmemory(void){ char p[]=”hello world”;return p;}void test(void){char *str=null;str=Getmemory();printf(str);} 请问运行 Test 函数会有什么样的结果.
char *GetMemory(void){ char p[] = "hello world";returnp; }void Test(void){char *str = NULL;str = GetMemory(); printf(str);}请问运行 Test 函数会有什么样的结果?
设有以下函数:voidfun(intn,char}s){……}则下面对函数指针的定义和赋值均正确的是( )。A.void(*pf)(int,char);pf=fun;B.void+pf( );pf=fun;C.void*pf( );*pf=fun;D.void(*pf)(int,char*);pf=fun;
下面的程序各自独立,请问执行下面的四个TestMemory 函数各有什么样的结果?①void GetMemory(char * p){p = (char * )malloc(100);}void TestMemory (void){char *str = NULL;GetMemory (str);strcpy(str, "hello world");prinff(str);}② char * GetMemory (void){char p[ ] = "hello world";return p;}void TestMemory (void){char * str = NULL;str = GetMemory( );printf(str);}③void GetMemory(char * * p, int num){* p = (char * )malloc(num);}void TestMemory (void){char * str = NULL;GetMemory(str, 100);strcpy( str, "hello" );printf(sir);}④void TestMemory (void){char *str = (char * )malloe(100);strepy (str, "hello" );free ( str );if(str ! = NULL){strepy( str, "world" );printf(str);}}
分析下面的程序,指出程序中的错误: # include <stdio.h> int main(void) { char a; char *str=a; strcpy(str,"hello"); printf("%sn",str); return 0; }