In C, what is the result of declaring a pointer as int *ptr; without initialization?Marks : 1Negative Marks : 0Answer hereThe value of the variableptr points to a specific known memory locationptr contains a garbage value as its addressptr points to the memory location 0
Question
In C, what is the result of declaring a pointer as int *ptr; without initialization?Marks : 1Negative Marks : 0Answer hereThe value of the variableptr points to a specific known memory locationptr contains a garbage value as its addressptr points to the memory location 0
Solution
The result of declaring a pointer in C as int *ptr; without initialization is that ptr contains a garbage value as its address. This is because without initialization, the pointer doesn't have a specific memory location to point to, so it contains a random or "garbage" value. It does not point to a specific known memory location or to the memory location 0.
Similar Questions
In C, what is the result of declaring a pointer as int *ptr; without initialization?
How do you initialize a pointer to the address of a variable 'x' ?Marks : 1Negative Marks : 0Answer hereint *ptr = x;int *ptr = &x;*int ptr;int *ptr = *x;
Comment on the following pointer declaration.int *ptr, p;
What is the correct syntax for declaring a pointer variable?Marks : 1Negative Marks : 0Answer hereint *ptr;pointer int *ptr;*int ptr;None of the mentioned options
Which of these is a correct way to initialize a pointer in C?Marks : 1Negative Marks : 0Answer hereint ptr = 0int *ptr = 0int ptr = NULLint *ptr = NULL
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.