Saturday, May 9, 2009

This is just a trivia for C buffs!! what does the declaration int*const*(*next)() mean????

Its the declaration of pointer to a function which returns an integer pointer.





I am however now sure of the const in this as you dont define the return type to be a const.





Hope this helps.





Sunil


www.careercurry.com


A human body has a temp of 37'C. Howdophsyical/chemical/and nuclear processes keep ahuman body at a const.temp

A healthy human body maintains a temperature of a bout a 37'C. Explain how phsyicalm chemical and nuclear processes all contribute directly or indirectly to keeping the human body at a constant temperture. Please let me knoe the answer or if any websites that are helpful.. asap.. plz.. and thankyou

A human body has a temp of 37'C. Howdophsyical/chemical/and nuclear processes keep ahuman body at a const.temp
Well... nuclear forces/reactions don't participate in thermal homeostasis (maintenance of equilibrium). The chemical reactions that give us energy and maintain the body also liberate heat (overall, they are exothermic)... we stoke the fire with calories from our diet. We also shunt blood to or away from the body surface to cool or maintain body heat.





Do a search on "thermal homeostasis human" and you should find information relevant to your question.





Aloha
Reply:Kreb's Cycle.





http://wine1.sb.fsu.edu/krebs/krebs.htm
Reply:The process described in your question is a biological function called homeostasis. The following link will explain: http://www.answers.com/topic/homeostasis


What is the difference between const keyword and #define for declaring constants in c language?

difference between


#define MAX 5


and const MAX=5

What is the difference between const keyword and #define for declaring constants in c language?
#define MAX 5;


const MAX = 5;


both are same in this case


the only difference comes when


#define sum(int x) { x=2+x; }


here we cannot use const


this is huge difference between them


thank u
Reply:const MAX=5 means the MAX variable would = 5, which woudl be constant, and you cant change the value. (of course, you would need to declare MAX as int or float if you were going to give it the value of 5.





#define MAX 5 is giving the word MAX a definition and the properties that you would use for it. You could change the value around, and it wouldnt necessary be constant, or, depending on how you use it, even an int or float value.
Reply:#define is a compiler directive. The value is assigned when you compile the program. The const MAX will be assigned at the run time.
Reply:#define is a macro compiler


Const is a declaration of constant, compiler will do appropriate checks during the compile time.


#define is a macro compiler will see a value.


Speaking in terms of memory const declaration could be more efficient:


const int MAX=5;


so u can't change the value.


#define can also be given arguments which are used in its replacement. The definitions are then called macros


What is the difference between 'Const' and 'static' in c++?

The 'const' keyword can be used in multiple places. Lets say I have a class called Box that has a method called "Create." My box class also has some member variables for its height width and length. I could have the following method signature:





const Box* Box::Create(const Dimension dim) const


{


// implementation would be here


}





As you can see I used the 'const' keyword a lot here. The first part part: "const Box*" means that the returned value cannot be modified. The second part "const Dimension dim" means the parameter that is passed into the method cannot be altered. The third "const" at the end of the method signature means that I will not modify any member variables on the Box class such as length, width, or height.





The 'const' keyword can also be used on variables to tell the compiler that the value should not change.





The static keyword gives a variable lifetime of the application. It goes into the "static" location in memory. It does not go on the stack and it does not get put on the heap. Heap memory is for dynamically allocated objects and stack data is parameters, return addresses, and local variables.





For more information on static you can look at the link referenced in a previous answer:


http://www.cprogramming.com/tutorial/sta...

What is the difference between 'Const' and 'static' in c++?
static const int num = 10;


const int num2 = 20; absolutely none defference...





The second form, probably. It is shorter.





If you were trying to create a header file that is compilable in both C and C++ code, then maybe it would make sense to use the explicit 'static', since in C constant objects have external linkage by default.





But apparently you are not trying to do that.
Reply:a const variable is constant and cannot be altered. A static variable is stored on the heap rather than on the call stack so it is accessible outside of the current scope and therefore can be shared between different processes.
Reply:A const is a constant, a more semantically correct evolution that used to be #DEFINE macros used in C, just const in C++ is more semantically correct and blends well in a program.





A static is just different, there are two says both correct but do depend on where you use it. Refer to the above wiki to figure it out.
Reply:Here is a web page with some information about static
Reply:They're not comparable.





Static variables live during the whole life of your program. Their scope depends on where they're declared.





Const variables cannot be changed.

surveys

NEED INFO ABOUT TYPE V-NR CONSTRUCTION AS PER ubc/cbc also, what is best const. type for c-store T.I.?

Please rephrase the question and I will try to answer. Please give me best answer just for reading your question as it stands. Thanks


How to change the value of const identifiers in c programming language ?

u may change it in the program


cheers

How to change the value of const identifiers in c programming language ?
"const" stands for constent. I is not supposed to change. Then if you need a different value the only solution is to change the source code and recompile.
Reply:what's the use of an identifier being "constant" if you want to change it?!??! make it a variable indentifier and problem solved.
Reply:U can change it only in the program..


U cannot change it at runtime..
Reply:U cannot change the const value


What is " const reference" in C++? How can I use it?

I'm a beginner. Can anybody help me?

What is " const reference" in C++? How can I use it?
Do you mean like a const pointer or const variable?


The 'const' keyword tells the compiler that the variable following the 'const' will not change.


It is a safety measure for your sake. If you mistakingly try to modify a 'const' variable in your program, the compiler will issue an error when you compile the code.





Examples:


const char a=15; // constant char


const char hello[]="hello!"; // constant string


const char *bah=%26amp;a; // constant pointer to a
Reply:I mean a const reference in functions, for example : ErrorCode Stack%26lt;Entry%26gt;::push(const Entry %26amp;item); after 3 days thinking, finally, I get the answer, const reference is 50% like value reference and the rest 50%, it's like a reference Report It



Where does const variable in c code in memory reside?

It sits in the heap that is allocated to your program by the OS. It doesn't reside anywhere special, it is just marked read only. There are ways around that if you really try.

Where does const variable in c code in memory reside?
I think it's compiled into the static data area of the executable. Sorry that's not very specific, but that's as much as I know.

survey monkey

Confused about CONST keyword in C++ and Reference variable?

Consider following code:


void main()


{


int i=10;


int %26amp;ref1=i;


int %26amp; const ref2=i;


const int %26amp;ref3=i;


}





here...


What is difference between ref1 and ref3?





because





in code we can do:





ref1++;


ref2++;


but we can not do ref3++;It gives compile time error:Const obj can't be modified.





If any body know exact and only difference between





int %26amp;ref1=i;


and


int %26amp; const ref2=i;





Both ref1 and ref2 work as normal reference to integer variable.

Confused about CONST keyword in C++ and Reference variable?
ref3 is a const reference, which means you can't modify it. You are declaring the reference itself to be const.





ref2 is a regular reference. the const keyword in this case means what the reference is bound to (in this case the variable i) will not change, which is ALWAYS the case with references. the const keyword here is totally meaningless. syntactically it is correct which is why the compiler doesn't complain. but for all intents and purposes, ref1 and ref2 are exactly the same.
Reply:%26amp; means "by reference," which is different than "by value."





When you call a variable "by reference," you are asking for its location in memory. Therefore, you can change the value of the variable simply by calling it.





For example:








int byValue(test) {


test = 6;


return test;


}





int byReference(%26amp;test) {


test = 6;


return test;


}





int test = 4; // test = 4





test2 = byValue(test); // test = 6, test2 = 6





test2 = byReference(test); // test = 6, test2 = 6





So, it matters where we put the ampersand -- it needs to be right up against the variable we want to call by reference.





In the line int %26amp;ref1 = 1, we're setting the value of ref1 to be 1, and we're doing so by reference. For all practical purposes, it's the same as saying int ref1 = 1; since we're declaring the variable, it's new to memory; since it doesn't have a reference until we create it, asking to assign its value by reference is moot.





int %26amp; const ref2 = 1 throws an error because it's basically trying to create the same constant twice. Since it errors, ref2 does not become a constant but does get assigned a value of 1.





The reason ref3 can't be changed is that even though we are calling it by reference, we have declared it a constant, and that has priority.
Reply:CONST : Constant. These are basically values that will never change. Example of this would be





CONST INT PI = 3.14159





The value of PI is always going to be that so you don't want to change that.





REFERENCE VARIABLE: Reference variables are mainly used when you are passing variables from one function to another. You pass it by reference meaning you are passing the address of the variable location. This will ensure that whatever changes you make the variable will be made to the variable.





In your program you are doing





ref2++ which will give you the error since a CONST object is something that cannot have a changing value.





You need a variable for this instead.


Describe usage of const in C++?

In C++, const is used to declare a constant. A constant is similar to a variable in the sense that it represents a memory location. It differs, as I sure you can guess, in that cannot be reassigned a new value after initialization. In general, constants are a useful feature that can prevent program bugs and logic errors. Unintended modifications are prevented from occurring. The compiler will catch attempts to reassign constants new values

Describe usage of const in C++?
There are two general reasons to use "const" - neither of which is mandatory - your code will work quite well without them.





The first reason is primarily of importance in embedded systems - those computers that are put into cars, aircraft and photocopy machines. These computers have ROM (Read Only Memory) for constants and for the program itself, and RAM (Random Access Memory) for stack, variables and things that can change - they typically do not have disk drives.





Now as a rule of thumb, ROM is cheap, RAM is expensive - you always try to minimize the use of RAM. Thus if you declare an array of constants that are guaranteed not to change - for example consider the following:





char *Days[] = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};





being of course, the days of the week. These clearly are constants that will never change - you won't get new days of the week. If we make the above declaration, the compiler will create a copy of the strings, and store it in ROM and when the program starts, it will make a copy of them into a RAM location, since it does not know that you are not going to try to change them.





If instead we make the following declaration:





const char *Days[] = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};





the compiler now knows that these are only constants and will never change. The compiler is able to put these into ROM and never copy them to RAM, since they are constants.





You will have just saved some precious RAM and earned the admiration of your peers.





This usage is of little importance in programs that will be running on desktop computers, as all programs are put into RAM anyway - you typically don't save anything by making such a declaration. It is however, considered to be good practice since it tells someone else that is reading your program that these are constants, and will never change.





The second reason is simply a promise that is made by a function not to change a variable. Consider the following prototype:





int memcmp (const void *s1, const void *s2, size_t n);





the first two parameters have "const" modifiers added. What this means is that it is a promise made by the "memcmp" function that it is not going to modify the data areas of either of the first two parameters.





This comes in handy in case you have worked hard to get data to be exactly as you want it to be, and you want to call another function that you didn't write. If you look at the prototype (as above), you can see that the function promises not to change your data, so it is safe to call it.





Here again, it is not an absolutely necessary thing to do, but it saves people time in having to check all of these functions to see if they muck up the parameters that are passed.


How to find the Complex Fourier coeff for f(x)=A*(1+B*Sinx+C*Cos2x), A,B,C are const, Limit is from 0 to 2Pi?

google it ma man..


google it


In c++ STL Difference betwen pair<const char,int> and map<char,int>?

in c++ STL Difference betwen pair%26lt;const char,int%26gt; and map%26lt;char,int%26gt;?


pleas explain operation of each function.

In c++ STL Difference betwen pair%26lt;const char,int%26gt; and map%26lt;char,int%26gt;?
Google works best.





(Hint: pair is utility element. It's a single unit. Map is a giant list of such pair units, where a pair is a key and its data.)
Reply:map can be considered as list of pairs

online survey

Difference between static char and const char in C?

Hey, is anyone out there aware of the difference between a static char and a const char in C?





I keep getting memory exceptions if I declare a const char (like I'm trying to write to the const char, but I'M NOT). But when I declare it static things work fine (and memory is not written over).





I assume both mean read-only, but is there any other difference? I'm just trying to track down why I'm getting such an odd error with const here.

Difference between static char and const char in C?
A constant is read-only, cannot be changed





A Static variable is read-write but is maintained (not erased) when the procedure/function in which it is declared exits.





so:


Proc A


Proc B


Proc B


Proc B


end





Proc B:


static aNum int


aNum = aNum + 1


print aNum


end





results in 1,2,3 for a static variable aNum
Reply:I'm not sure but I am interested myself in finding out the problem. Have you tried tek-tips.com? I'm sure one of the experts there will be able to help.


What is difference between #define and const keyword in c language?

frends can any body tell me #define and const in c language regarding their usage and practice.

What is difference between #define and const keyword in c language?
# define is a preprocessor directive which tells the compiler to replace the variable with the string before compilation.





Const is a normal variable whose value can't be changed.
Reply:The const keyword declares a "read-only variable" if you will, whereas the #define keyword is a compiler directive, and can be used to define more than just values. For instance





#define INCX x++;





is a valid definition, which could be used as follows:





int main


{


int x=0;


INCX


return x;


}





This is a valid program, will compile, and will return the value 1. This is a pointless example, but I think it should help explain the difference.





Rawlyn.


What is difference between c++ const and c const?

you are going to get the best answer in my link


http://www.geocities.com/karthika_79/dif...