Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 203 Vote(s) - 3.66 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What's meaning of these volatile with pointers in C ?

#1
volatile void * ptr;

Whether `ptr` is `volatile` or it points to the `volatile location`.

So the actual doubt is :
Is the same thing applied to the above declaration as it applied with `const` qualifier ?

Little explanation will help me a lot.

Reply

#2
A [Microsoft explanation][1]:

> The volatile keyword specifies that the value associated with the name that follows can be modified by actions other than those in the user application.

The volatile keyword is useful for declaring objects in shared memory that can be accessed by multiple processes.

[1]:

[To see links please register here]

Reply

#3
It's a pointer to volatile data. If the pointer itself should be volatile but not the data it points at, you'd use:

void * volatile ptr;

So yes, it works the same way as the `const` modifier.
Reply

#4
Both `const` and `volatile` are [type qualifiers][1] (they're the only type qualifiers in C, in fact). The syntax for using them is identical.

[1]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through