网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

【多选题】有函数原型如下,下列各项正确的是() void input(char *p)

A.char name[]="string"; input(name);

B.char name[]="string",*p; p=name; input(p);

C.int a[10]; input(a);

D.int a[10],*p; p=a; input(p);


参考答案和解析
C
更多 “【多选题】有函数原型如下,下列各项正确的是() void input(char *p)A.char name[]="string"; input(name);B.char name[]="string",*p; p=name; input(p);C.int a[10]; input(a);D.int a[10],*p; p=a; input(p);” 相关考题
考题 设有以下函数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;

考题 考虑以下的函数原型:void A(int a,int b=5,char Z='*');下面的函数调用中,不正确的是( )。A.A(7)B.A(3,4)C.16,'#'D.A(O,2,'*

考题 以下程序有语法错误,有关错误原因的正确说法是main(){ int G=5,k;void prt_char();...k=prt_char(G);...}A.语句 void prt_char();有错,它是函数调用语句,不能用void说明B.变量名不能使用大写字母C.函数说明和函数调用语句之间有矛盾D.函数名不能使用下划线

考题 设有如下函数定义int f(char *s) {char *p=s;while(*p!=’\0’) p++;return(p-s);}在主函数中用coutA、3B、4C、5D、6

考题 考虑函数原型void test(int a,int b=7,char="*"),下面的函数调用中,属于不合法调用的是()A: test(5)B: test(5,8)C: test(6,"#")D: test(0,0,"*")

考题 请编写一个函数char*change(char instr[]),将输入字符串中的所有小写字母转换为大写字母输出。要求使用for循环实现。如输入jinfeiteng,则输出结果是JINFEITENG。注意:部分源程序已存在文件test21_2.cpp中。请勿修改主函数main和其他函数中的任何内容,仅在函数change的花括号中填写若干语句。文件test21_2.cpp的内容如下:char*change(char instr[]);include"iostream.h"void main(){char instr[50];char *outstr;cout<<"Input a string:"<<endl;cin>>instr;utstr=change(instr);cout<<"Over graded string:"<<endl;cout<<outstr<<endl;}char*change(char instr[]){}

考题 请补充函数fun,该函数的功能是比较字符串str1和str2的大小,井返回比较的结果。例如: 当str1=“cdef",str2=“cde”时,函数fun()返回“>”。注意:部分源程序给出如下。请勿改动主函数main 和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include< stdio, h>include<conio. h>define N 80char *fun (char *str1,char *str2){char *p1=str1, *p2=str2;while (*p1 *p2 ){if (【 】)return "<";if(【 】)return ">";p1++;p2++;}if (*p1=*p2)return "==";if (*p1==【 】)return "<";elsereturn ">";}main(){char str1 [N], str2 [N];clrscr ();printf ("Input str1: \n");gets (str1);printf ("Input str2: \n");gets (str2);printf ("\n*****the result*****\n");printf ("\nstr1 %s str2", fun (str1, str2) );}

考题 有如下类定义:class Bag {public:Bag(int p,char s='M'):price(p),size(s) { count++; }~Bag() { count--; }int GetPrice() { return price; }int GetPrice() const { return price; }void SetPrice(int val) const { price=val; }private:int price;char size;static int count;};下列关于类成员的叙述中,正确的是( )。A. 成员函数GetPrice存在重定义B.构造函数的参数不能设置默认值C.析构函数中不能访问静态数据成员D.成员函数SetPrice不能定义为常函数

考题 有以下程序: include void funl (char * p){char * q; q=p; while( *q! ='\0') } (*q) 有以下程序: #include <stdio.h>void funl (char * p){ char * q; q=p; while( *q! ='\0') } (*q) ++;q++;}mains( ){ char a[ ] = { "Program" } , * p; p = a[3]; fun1 (p); printf("% s \n" ,a);}程序执行后的输出结果是( )。A.ProhsbnB.PrphsbnC.ProgsbnD.Program

考题 有以下程序 include void fun(char **p) { ++p; printf("%s\n",*p); 有以下程序 #include <stdio.h> void fun(char **p) { ++p; printf("%s\n",*p); } main() { char *a[]={"Moming","Afternoon","Evening","Night"}; fun(a); } 程序的运行结果是A.AfternoonB.fternoonC.MorningD.orning

考题 设有以下函数: 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 setmemory(char **p, int num){ *p=(char *) malloc(num);}void test(void){ char *str=NULL;getmemory(str,100);strcpy(str,"hello");printf(str);}运行test函数有什么结果?( )

考题 下面的函数原型非法的是 ______。A.void f(int a=1,int b=1)B.int f(double f,char s,int i=1,int j)C.void f(int a, int b)D.int f(double f,char s,int i=1,int j=0)

考题 已知类 String 的原型为class string{public:string(const char *str=null);//普通构造函数string(const string other);//拷贝构造函数---string(void);string operate=(const string other);//赋值函数private:char * m-data;//用于保存字符串};请编写 string 的上述4 个函数

考题 有关内存的思考题1. void getmemory(char *p){ p=(char*)mallol(100);}void test(void){char * str =null;getmemory(str);strcpy(str,”hello,world”);printf(str);}请问运行 Test 函数会有什么样的结果

考题 char*getmemory(void){ char p[]=”hello world”;return p;}void test(void){char *str=null;str=Getmemory();printf(str);} 请问运行 Test 函数会有什么样的结果.

考题 对于函数原型void function(int x,float y,char z='a'),合法的函数调用是( )。A.function(2,3.Of)B.function(2,3,4)C.function(2)D.function()

考题 void GetMemory(char *p){p = (char *)malloc(100);}void Test(void) {char *str= NULL;GetMemory(str); strcpy(str, "hello world");printf(str);}请问运行 Test 函数会有什么样的结果?

考题 char *GetMemory(void){ char p[] = "hello world";returnp; }void Test(void){char *str = NULL;str = GetMemory(); printf(str);}请问运行 Test 函数会有什么样的结果?

考题 Void GetMemory2(char **p, int num){*p = (char *)malloc(num);}voidTest(void){char *str = NULL;GetMemory(str, 100);strcpy(str, "hello"); printf(str); }请问运行Test 函数会有什么样的结果?

考题 编写类 String 的构造函数、析构函数和赋值函数已知类 String的原型为:class String{public:String(const char *str = NULL); // 普通构造函数String(const String other); // 拷贝构造函数~ String(void); // 析构函数String perate =(const String other); // 赋值函数private:char *m_data; // 用于保存字符串};请编写 String的上述 4 个函数。

考题 阅读以下函数说明和C语言函数,将应填入(n)处的字句写在对应栏内。[说明1]函数void fun(char*w,char x,int*n)用来在w数组中插入x,w数组中的数已按由小到大顺序存放,n指存储单元中存放数组中数据的个数,插入后数组中的数仍有序。[C函数1]void fun(char*W,char x,int*n){ int i,P;p=0;w[*n]=x;while(x>w[p]) (1) ;for(i=*n,i>p;i--)w[i]=(2);w[p]=x;++*n;}[说明2]函数void revstr(char*s)将字符串s逆置。例如:字符串“abcde”,经过逆置后变为“edcba”。[C函数2]void revstr(char*s){ char*p,c;if(s==NULL)return;p=(3); /*p指向字符串s的最后一个有效字符*/while(s<p){ /*交换并移动指针*/C=*s;(4)=*p;(5)=c;}}

考题 设有以下函数: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);}}

考题 若有如下程序: void a(char*p,char c) {while(*p) { if(*p==c)*p=c-'b'+'B';; p++; } } main() {char s[50]="abcdeeffgee",b='e'; a(s,b);printf("%s\n",s); } 则程序运行后的输出结果是( )。A.AbcdeeffgeeB.ABCDeeFFGeeC.abcdEEffgEED.ABCDEEFFGEE

考题 根据下面函数原型编写一个函数,求出并返回由字符指针a所指向的字符串中包含的字符’a’和’A’的总个数。int void fun(char* a);

考题 单选题假设函数fun已经定义,其原型为“void fun(int a,int b=7,char*p=“**”);”,下列函数调用中错误的是(  )。A fun(5)B fun(5,8)C fun(6,“##”)D fun(0,0,“==”)

考题 单选题有以下函数:void fun(char*p,char*q){ while((*p++=*q++)!='\0');}该函数的功能是(  )。A 计算字符串的长度B 计算字符串所占字节数C 将字符串逆序存放D 实现字符串的复制