From what I have read a NULL pointer points to the memory location "0" and an unitialized pointer points to a random location? Could it be that this random location sometimes is the "0" so that it is a NULL pointer as well? I realize that this will not happen all the time, but could it happen? Or has C some mechanism to stop it from happening?
Could an unitialized pointer be a NULL pointer?
72 Views Asked by user394334 At
1
There are 1 best solutions below
Related Questions in C
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in POINTERS
- What does: "char *argv[]" mean?
- Memory allocated for pointer to string literals
- change the value of double pointer with indirection(dereference) operator cause segmentation fault
- Unexpected result when assigning and printing pointer value of two-dimensional array with its name
- The character array data changes when I use it inside for loop. I do not understand why does it change, the data ")" becomes "("
- char * gives garbage value when pointing to a variable of a function in C
- What is correct way to copy struct instance with fields in Go?
- PHP FFI: How to pass PHP class object to C++
- How to make a single slider with three pointer
- rac dangling pointer crash。
- Is casting "pointer to array of type" to "pointer to type" defined?
- C++: How to implement a pointer to another class as a member?
- What is the purpose of (int *) p here?
- Initialize a structure pointer to NULL, then try to change its members
- Could an unitialized pointer be a NULL pointer?
Related Questions in NULL
- I initialize my ViewModel in the Activity with several fragments as tabs, but the fragments(tabs) return null for the updated livedata
- Why is getValue preferred over !! when retrieving from a Map (NoSuchElementException vs NullPointerException)?
- Not getting Live data from Aviationstack api
- BigQuery: How to filter out nulls from ARRAYS of STRUCT
- Git hook for git worktree doesn't run "git submodule update --init --recursive" properly
- Could an unitialized pointer be a NULL pointer?
- Group By clause returning too many rows
- DOM is not being uploaded for my Etch-A-Sketch board
- TTS doesn't initialize in Android 11
- QueryDSL BooleanExpression exclude data if the field is null
- Swift decoding error types inconsistency with `Bool` type
- Laravel Form Set Default Selection
- CTE with Left Join not returning NULL values
- The variable 'a' is of a reference type, and 'A' is a custom class. When the value of 'a' is null, why does 'a is A' result in true?
- How to fix the "attempt to index nil with 'PrimaryPart'
Related Questions in INITIALIZATION
- How do I initialise a class within a class
- Initializing problem with a variable for a distance calculator in Java with if and else statement
- Is there are a way to determine process stages from inside a library
- Could an unitialized pointer be a NULL pointer?
- Initialization of an empty Bash indexed array
- Flutter dropdownMenue with conditions
- How to migrate to standalone in angular
- for loop initialization failure
- Why does my console.log output the incorrect HTML slider value in JavaScript?
- Why does VS Code give me this error? : non-aggregate type 'list<int>' cannot be initialized with an initializer listgcc
- Initialize std::array of certain type, but any size?
- Why would anyone declare a variable before defining it? Please provide example
- Why is clang-tidy giving me an uninitialized error for this c++ code?
- Why is my C++ program running fine with the debugger but not without it?
- Is there a way trough some method or property to postopone initialization of setGrid method of some ChildComponent in Angular?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
An uninitialized pointer could be a null pointer.
(Do not use “NULL” for a null pointer.
NULLis a specific macro defined by standard C headers with some different implications.)Many C implementations use memory address zero for null pointers, but this is not the only possibility. The C standard merely requires a null pointer to compare unequal to any object or function in the C program.
No, “random” is a different concept. Saying something is random is asserting there is a lack of pattern or predictability to it. While it would not violate the C standard for an uninitialized object to behave randomly, the C standard does not say it does that, and it is unlikely that an uninitialized object would actually behave randomly rather than having at least some pattern of behavior arising out of the programming environment, although not a pattern controlled by the C standard.
An uninitialized object is said to have an indeterminate value. An indeterminate value is not any particular value but is a description of how the object behaves. Effectively, it means the C standard does not require the object to have a determined value—in other words, the value is not fixed; it can appear to be different at different times—and does not require a C implementation to take the value from any particular place, including the memory reserved for the object.
This means that, during optimization, a compiler may take the value of the object from memory, from a processor register, or anywhere else, and it may use different sources at different times, and other aspects of the program or the environment may change whatever source or sources the program is using for the value. So the value of the object in the program may appear to change.
For example, if
ais an uninitializedint, thenprintf("%d\n", a); printf("%d\n", a);could print two different numbers.It can happen that the value used for an indeterminate pointer is a null pointer.