answersLogoWhite

0

You must have made an error, it should work perfectly. Example:

int main (void)

{

static int foobar;

printf ("Address of foobar is %p\n", &foobar);

return 0;

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

Which is the syntax used for passing a structure member as an argument to a function?

You can pass the address by using '&' with the pointer variable, while passing actual arguments. In formal arguments '*' is used in the place of '&'. To pass the address of a pointer variable a double pointer variable should be used .


Can static electricity pass through wires?

Yes, static electricity can pass through wires by creating a flow of electrons. However, the ability of static electricity to pass through wires depends on the voltage and conductivity of the wire.


Can a variable name can be passed to a value parameter in c plus plus?

No. Pass by value always receives a copy of the value being passed. Even if it were possible to physically pass a user-defined identifier into a function by value, the compiled code would not recognise the name since all identifiers are stripped out by the compiler and replaced with memory addresses. Strictly speaking, even pass by reference does not pass the variable name, as the function argument is simply an alias, an alternate but informal name, for the formal name you actually pass. In essence you are passing the memory address of the variable, rather the value of the memory address as you would with pass by value.


When a reference variable is passed to any function than whether it pass address or a copy of a variable?

You cannot arbitrarily determine what is passed to a function from outside of the function. If the function expects a reference, then the memory address of the variable will be automatically passed to the function. If the function expects a value, then a copy of the variable's value is automatically passed instead. In other words, it is the function signature that determines what is passed, not how you call the function.


Why pointers are required?

The most important use of pointers comes when we pass value by reference to any function. You do not need to create a second memory location as in pass by value. You can mofify the original variable by using its address.


Cant pass dns test for xbow live?

you need to typ in all web address and passwords and good on ya not gettin a ps3 there **** =)


How is an array name interpretedwhen it is passed to a function?

An array is still an array, regardless of how you pass it into functions. It is still an array-type variable at the beginning of a function. However, the function itself may manipulate the array by "imploding" it into a string with a delimiter, using array values with only specific keys, and such.


What is the main difference between static and dynamic pass box?

Static pass through boxes are used to transfer materials between two clean rooms that are equally clean. Dynamic pass through boxes are used to transfer materials from uncontrolled environment to a controlled environment.


Difference between static methods and static variables?

StaticIn the C language family, a static variable is one that exists for the lifetime of a compilation unit (a source file or module). A static variable can be declared module-wide, and thus be accessed by all functions defined within the same source file. Such a static variable cannot be directly accessed from other modules, but inner-module API can pass pointers to static variables and modify those through pointers.A static variable can also be declared within a function body, where the usual scope rules apply. A static variable declared within a function is only initialized when the module is initialized (typically when the application loads), and preserves its values over multiple invocations of the function that contains the definition.In C++, a static variable can also be a member of a class definition. Access to a static member variable is governed by the standard access modifiers (private, public, protected), but all instances of this class share the same static variable, and share the same value. Modifying the value of this variable affects all objects of the class.VolatileThe volatile keyword is something all together different, and not in any way an opposite to static. A static variable may or may not be declared volatile, just as a global or local variable can be.The volatile keyword is a hint informing the compiler that the variable's value might change without the compiler's knowledge. Therefore, the compiler's code optimizer cannot make assumptions about the variable's current value, and must always (re-) read the variable's content.Volatile variables are sometimes used in context with interrupt handlers (although those normally benefit from more sophisticated synchronization methods such as semaphores, mutexes or locks). Most typically, volatile variables are used to model hardware registers through variables.For example, consider a hardware register at address 0x1234, containing a single byte. The value of this byte is hardware driven and contains, for example, the current ambient light level in a range of 0..255. Such a register could be modeled with this construct:unsigned char *const volatile lux = (unsigned char *)0x1234;unsigned char firstReading = *lux;unsigned char secondReading = *lux;In this example, the volatile keyword ensures that the second reading is taken from the hardware register again. Without, a good compiler will read the memory address once and assign the same value to both variables.


How do you do the pass the variable value to the query in same php page?

To pass PHP Variable value in Jquery simpley echo that variable : Eg <script> var jQueryVariable=<?php echo $anyVariable?> </script>


Does a variable pass through the origin?

A variable passes through the origin if its value is 0 at that point.


Differentiate Pass by reference and pass by value parameter passing scheme?

parameter passing :the value of the variable is passed to the called function,but the passed value cant be changed by the function.ex:int main(){int a,b;a=5;foot(a);printf("%d",a);}void foot(int x){x=7;}here the value of a ie.5 is passed to the function foot(),and the value 5 is printed since the value of tat variable cant be changed ...here the address of the variable is send to the function,the function can change its value.ex:int main() {int a,b;a=5;b=7;foot(&a,&b);printf("%d%d",a,b);}void foot(int *x,int *y){*x=6;*y=8;}here the address of a is assigned to x and address of b to y,so by using this more values can be referenced..here &a means it is pointing to an address,*x means it is an indirection pointer tat points indirectly to the or tat references indirectly the value of a.hence x references a and y references b.