print在C语言里是什么意思

2025-06-28 06:37:33
推荐回答(2个)
回答1:

我搜遍了所有的 Turbo C 语言头文件,发现 LIST2.H 和 STACK2.H 中分别有以下函数定义:

LIST2.H

// Borland C++ - (C) Copyright 1991 by Borland International

// list2.h:   A Integer List Class
// from Hands-on C++
const int Max_elem = 10;

class List
{
protected:     // The protected keyword gives subclasses
               // direct access to inherited members
   int *list;        // An array of integers
   int nmax;         // The dimension of the array
   int nelem;        // The number of elements

public:
   List(int n = Max_elem) {list = new int[n]; nmax = n; nelem = 0;};
   ~List() {delete list;};
   int put_elem(int, int);
   int get_elem(int&, int);
   void setn(int n) {nelem = n;};
   int getn() {return nelem;};
   void incn() {if (nelem < nmax) ++nelem;};
   int getmax() {return nmax;};
   virtual void print();                   // line 22
};

STACK2.H

// Borland C++ - (C) Copyright 1991 by Borland International

// stack2.h:   A Stack class derived from the List class
// from Getting Started
#include "list2.h"

class Stack : public List                  // line 5
{
   int top;

public:
   Stack() {top = 0;};
   Stack(int n) : List(n) {top = 0;};      // line 11
   int push(int elem);
   int pop(int& elem);
   void print();
};

都有 print 函数,但是没有函数体。

通过网络也无法查到相关信息。

自己摸索吧。。。

回答2:

没有上下文,不知道什么意思 。。。。。。。。。。