TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: David Burns
from: Kurt Kuzba
date: 1998-07-10 00:46:30
subject: What Now?

DB>   Are header files interchangeable?
   No. Each compiler has its own. They should be practically the
   same, but no interchangeability is guaranteed. The headers
   are matched to the .lib files used by each compiler, and may
   contain #define, enum{}, or typedef preprocessor commands
   specific to themselves even if all the functions are similar.
DB>   what's a # define statement for?
   To define a macro or a variable.
   Code bits or values which are set in a #define preprocessor
   command will be replaced IN TEXT before compiling with the
   value defined or the code bit.
#include 
#include 
#define MAX 128
#define Lessor(a, b) (((a < b) ? a : b))
int main(int argc, char **argv)
{
   int comp_value = atoi(argv[1]);
   printf("The lesser value is %d\n", Lessor(MAX, comp_value));
   return 0;
}
   When the compiler gets the printf() line, it looks like this:
printf("The lesser value is %d\n",
   ((128 < comp_value) ? 128 : comp_value));
 
DB>   Why would you wish to put variable names or the word VOID
DB>   in a procedure name?  main(x) for instance.
   FUNCTION. Procedures are Pascal. In C, we use functions.
   The variables in the parentheses are the function arguments.
   These are the variables which must be supplied by the calling
   function.
int Lessor(int a, int b)
{
   return (a < b) ? a : b;
}
int Lessor(int a, int b)
{
   int c = a;
   if(a > b)
      c = b;
   return c;
}
   These two examples are functionally similar. In each case,
   you would call the function like this:
val_less = Lessor(val1, val2);
   The number and type of arguments passed to the function must
   match the number and type of arguments in the prototype.
   The function may then use those variables to provide a useful
   return value, or perform various types of manipulation using
   them or upon them.
DB>   Is it similar to Basic where you'd have:
DB>   Sub Main(foo,bar): whatever: end sub
DB>   in order to 'receive' parameters?
   Yes. BASIC, however, passes by reference as a default.
   You cannot do this in C, though you can in C++.
   In C, you may only pass a value. That value may be a pointer
   to the variable, which gives you access to the variable
   itself and allows you to modify it, but now we are running
   a bit ahead.

> ] So far, nobody has ever wanted to ride the Unicorn twice....

---
* Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)
SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728
SEEN-BY: 639/252 670/213 218
@PATH: 154/750 222 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.