首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到19条相似文献,搜索用时 265 毫秒
1.
鲍远慧 《微机发展》2001,11(3):80-80,F003
在C/C++语言中,函数可以带参数,也可以不带参数,还可以带数目不定的参数。本文介绍如何编制形参个数不定的函数及其使用。  相似文献   

2.
C/C++是函数型的语言,能根据具体情况编制相应的函数是学习C的关键。由于函数通常使用同样数目和类型的参数,所以将参数传递给函数比较简单。但是,并非所有的函数都是这样。例如:常用的库函数:Printf与scanf等,每次调用时,就可以用不同类型与数目的参数。这是因为这一类函数具有一个可变的参数表。由于函数能处理较多的数据与不同类型的数据,所以函数的实用性得到了增强。由于有了可变参数表,可以只编写一个函数,而不是几个函数,所以会使得程序代码显得更简洁。C及C++的库函数中就有不少具有可变参数表的函数。当然,用…  相似文献   

3.
函数是C语言程序设计的核心,函数的参数的地位更显得重要,本文从C语言中参数的使用语法、指针参数、数组参数、函数的返回值几个方法论述了C语言中函数参数的使用技术,并对其进行了小结,为C语言教学中及C语言程序设计提供参考。  相似文献   

4.
林朝阳 《电脑》1994,(12):34-35
利用C语言里的几个简单函数如sound( ),nosound( ),delay( ),就可以编出简单的音乐软件来,既有趣,又可为你自编的应用程序增加色彩.想试一下吗?音乐中有两个最重要的量——音高和音长.音高可以利用sound( )函数来实现,sound( )的参数是无符号整数,代表的是发声的频率,也就是音高.如 C=262Hz,A=440Hz,利用sound(262)即可发出C音.音符的音长,则可以通过delay( )函数实现.delay( )的参数也是无符号整数,代表的是停留时间(以毫秒计).在有的时侯,可能需要禁止扬声器发声,此时可用nosound( )函数,它没有参数.上述函数,在TURBOC 2.0中都有.  相似文献   

5.
在当今普遍流行的操作系统中,对文本文件的显示与拷贝可以说是举手之劳,但是在Turbo C环境下实现该功能就显得捉襟见肘了,用C语言中带参数的程序设计方法可以实现该功能。  相似文献   

6.
吴敏 《微计算机应用》2005,26(5):578-578
为定义能操作任何类型的类和函数,C++提供了“模板”工具,它允许把类型作为类和函数的参数。  相似文献   

7.
本文以二次Bernstein基函数为例,首次提出了含双参数基函数的新扩展——αβQ—Bern-stein基函数,此类基函数具有新的特点,即基函数的扩展次数一次性升高两次,且包含了二次多项式和带一个参数的三次多项式基函数的所有性质。基于这组基函数定义了αβQ—Bézier曲线,该曲线也含有参数,具有形状可调性,当α与β取某些值时曲线能达到C4连续或在某个端点处C0连续。最后与含两个参数的升一次Bézier曲线进行比较,该曲线具有调节范围广、灵活性更强的优势。  相似文献   

8.
一类二元有理插值曲面的有界性和逼近性质   总被引:1,自引:1,他引:0       下载免费PDF全文
构造了一种带参数的仅基于函数值的分子为双四次、分母为双二次的二元有理插值样条函数。得到了二元有理插值样条函数的矩阵表示,给出了插值曲面在插值区域上C1光滑的一个充分条件,讨论了插值基函数的性质和插值函数的有界性及误差估计。由于插值函数中含有参数,这样可以在插值数据不变的情况下通过对参数的选择进行插值曲面的局部修改。  相似文献   

9.
C语言与汇编语言之间的接口是从事计算机软硬件人员应熟练掌握的一门技术指针是C语言中引入的重要概念之一,灵活地运用它可以使函数问参数的传递简单方便。本文仅以在科技开发工作中总结出来的具体实例说明Borland C 与汇编语言之间指针传递的几种方式。所给例程均已在IBM386上运行通过。1.整型近指针的传递,返回整型值近指针的情况  相似文献   

10.
构造了一种带参数的仅基于函数值的分子为双四次、分母为双二次的二元有理插值样条函数,插值函数具有简洁的显式表示。插值函数中含有4个参数,当这些参数满足一定条件时,插值曲面在插值区域上C1光滑。由于插值函数中含有参数,这样可以在插值数据不变的情况下通过对参数的选择进行插值曲面的局部修改。最后讨论了插值函数的一些性质。  相似文献   

11.
In designing a general purpose subroutine package to solve a class of problems, one often has to write subroutines with a large number of arguments. Although these arguments are required to cover a range of possibilities, many of these arguments have some commonly occurring values. The user is thus burdened with supplying a long list of arguments and making sure that the number and types match. An alternate solution is to write such subroutines in assembly language so that they could have a variable number of arguments. This approach is expensive and eliminates a large class of program designers who do not and do not want to know assembler language. This paper describes a facility which enables these program designers to write their routines completely in a higher level language (FORTRAN) and yet enjoy the ‘luxury’ of having a variable number of arguments in the calling sequence.  相似文献   

12.
The second-order matching problem is to determine whether or not a first-order term without variables is an instance of a second-order term that is allowed to contain not only individual variables but also function variables. It is well known that the second-order matching problem is NP-complete in general. In this paper, we first introduce the several restrictions for the second-order matching problems, such as the bounded number, arity and occurrence of function variables, ground that contains no individual variables, flat that contains no function constants, and predicate that no function variable occurs in the terms of arguments of each function variable. By combining the above restrictions, we give the sharp separations of tractable second-order matching problems from intractable ones. Finally, we compare them with the separations of decidable second-order unification problems from undecidable ones.  相似文献   

13.
Sentences containing both the AND and the OR connectives (e.g. A and B or C) may be interpreted either as "(A and B) or C" or as "A and (B or C)". The present study explored the effects of two variables—the order of the two connectives and category membership of the arguments connected—on the interpretation of such sentences. Some 160 undergraduates had to choose between alternative interpretations of a sentence involving three arguments connected by AND and OR. It was found that in most cases AND is considered to bind the arguments more strongly than OR. However this tendency is order- and content-sensitive.  相似文献   

14.
It is possible, by appropriate programming language extensions, to use the assignment statement as the sole means of changing the value of a variable, thereby eliminating the need to modify routine arguments by output parameters. Several suggestions are made to enhance the syntax and semantics of routine definition and assignment to maintain notational convenience and efficient execution normally associated with output parameters. Finally, an almost complete implementation of the ideas is presented in C.  相似文献   

15.
Programming languages which use dynamic identification for free variables (i.e., non-local references) are generally implemented with a deep or shallow binding variable access strategy. In this paper, variable access through the binding environment is assumed to be desirable. Given this assumption, it is demonstrated that the act of assigning values to variables may yield unexpected results for some of the binding strategies when functional arguments and results are used. A number of variations of deep and shallow binding strategies are examined along with the modifications necessary to implement the assignment operation in the expected manner.  相似文献   

16.
In general, logic programs are undirected, i.e., there is no concept of “input” and “output” arguments to a procedure. An argument may be used either as an input or as an output argument, and programs may be executed either in a “forward” direction or in a “backward” direction. However, it is often the case that in a given program, a predicate is used with some of its arguments used consistently as input arguments and others as output arguments. Such mode information can be used by a compiler to effect various optimizations. This paper considers the problem of automatically inferring the models of the predicates in a program. The dataflow analysis we use is more powerful than approaches relying on syntactic characteristics of programs. Our work differs from that of Mellish in that (1) we give a sound and efficient treatment of variable aliasing in mode inference; (2) by propagating instantiation information using state transformations rather than through dependencies between variables, we achieve greater precision in the treatment of unification, e.g. through =/2; and (3) we describe an efficient implementation based on the dynamic generation of customized mode interpreters. Several optimizations to improve the performance of the mode inference algorithm are described, as are various program optimizations based on mode information.  相似文献   

17.
This paper presents an improvement of Herbrand's theorem.We propose a method for specifying a sub- universe of the Herbrand universe of a clause set S for each argument of predicate symbols and function symbols in S. We prove that a clause set S is unsatisfiable if and only if there is a finite unsatisfiable set of ground instances of clauses of S that are derived by only instantiating each variable,which appears as an argument of predicate symbols or function symbols,in S over its corresponding argument's sub-universe of the Herbrand universe of S.Because such sub-universes are usually smaller(sometimes considerably)than the Herbrand universe of S,the number of ground instances may decrease considerably in many cases.We present an algorithm for automatically deriving the sub-universes for arguments in a given clause set,and show the correctness of our improvement.Moreover,we introduce an application of our approach to model generation theorem proving for non-range-restricted problems,show the range-restriction transformation algorithm based on our improvement and provide examples on benchmark problems to demonstrate the power of our approach.  相似文献   

18.
In this article the argumentation structure of the court??s decision in the Popov v. Hayashi case is formalised in Prakken??s (Argument Comput 1:93?C124; 2010) abstract framework for argument-based inference with structured arguments. In this framework, arguments are inference trees formed by applying two kinds of inference rules, strict and defeasible rules. Arguments can be attacked in three ways: attacking a premise, attacking a conclusion and attacking an inference. To resolve such conflicts, preferences may be used, which leads to three corresponding kinds of defeat, after which Dung??s (Artif Intell 77:321?C357; 1995) abstract acceptability semantics can be used to evaluate the arguments. In the present paper the abstract framework is instantiated with strict inference rules corresponding to first-order logic and with defeasible inference rules for defeasible modus ponens and various argument schemes. The main techniques used in the formal reconstruction of the case are rule-exception structures and arguments about rule validity. Arguments about socio-legal values and the use of precedent cases are reduced to arguments about rule validity. The tree structure of arguments, with explicit subargument relations between arguments, is used to capture the dependency relations between the elements of the court??s decision.  相似文献   

19.
C语言DSP电机控制功能模块由一结构体类型来组织,内含输入变量,历史变量、参数变量、输出变量、功能函数的指针变量。通过声明结构体类型、定义结构体变量,赋予结构体变量初值,调用其功能函数来实现其模块功能。通过用DSP控制两个电机C语言程序的开发可看出,用功能函数共享和移植的方法,可充分利用现有现成或成熟的软件资源,快速、高效、可靠地开发新的程序、模块和软件。  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号