?
Solved

Definitions of basic C terms

Posted on 2003-11-10
3
Medium Priority
?
389 Views
Last Modified: 2012-05-05
Hi, i have some questions in regards to C programming.

1) I am wondering, what is the difference between absolute & relative boolean statements?
2)How is storage space allocated for dynamic variables?
3) What is an indexed function?

Can some one provide answers with examples for the above questions?

Thanks in advance.  :-)
0
Comment
Question by:FOXBAT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 46

Accepted Solution

by:
Kent Olsen earned 200 total points
ID: 9714929

1)   In general, conditional boolean expressions get translated by the compiler into branches of control, i.e. "if" statements, whereas absolute boolean expressions may be translated in a similar way to arithmetic expressions.  Relative boolean is a term that I'm unfamiliar with.

2)  All dynamic variables will be placed on the stack or the heap, depending on how they are created.  The general rule is, if C creates the variable it goes on the stack and if the user code creates the variable it goes on the heap.

3)  An indexed function is simplay an array that contains the addresses of functions instead of data values.  It turns code like this:

if (a==0)
  Function0 ();
else if (a == 1)
  Function1 ();
else if (a ==2)
  Function2 ();

into this:

void *FunctionTable[3] = {Function0, Function1, Function2};

FunctionTable[a]();  /*  Execute Function0, Function1, or Function2 depending on the value of a  */



Kent

0
 
LVL 22

Expert Comment

by:grg99
ID: 9715206

1) I am wondering, what is the difference between absolute & relative boolean statements?

Hmm, never heard of "absolute" or "relative" as applied to booleans, and never heard of a "boolean statement" either.
Boolean *expressions*, boolean *functions*  boolean *operators*, boolean *variables*, but I can't fathom what a "boolean statement" might be.  Perhaps eitehr you or the question writer is a bit confused?


2)How is storage space allocated for dynamic variables?


variables local to a function or  {} block are allocated on the stack.  The stack is a very simple and economical way to allocate variables.  Only drawback is they can only be deallocated in a Last In, First Out fashion.    If you need a dynamic variable to persist longer than that, you have to allocate it on the "heap" with new or malloc or similar function.    These variables stick around until you explicitly free() them.  Heap storage is a bit more expensive and problematic to use, as the heap can get fragmented and heap allcoaton htakes a bit more time than stack allocation.



3) What is an indexed function?

No idea.   It could be an array that holds function pointers, or a function that returns an array index, or a function that you apply an index to.

Since this quiz seems to have a distressing number of "special" terms, you might have to start attending the lectures to pick up all these special terms that your teacher seems to be making up.  

0
 

Author Comment

by:FOXBAT
ID: 9719474
Thankx, just as i thought = D
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question