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
Question
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
Solution
The correct syntax for declaring a pointer variable in C/C++ is int *ptr;. This declares a pointer of type int. The other options are incorrect.
Similar Questions
What is the correct syntax for declaring a pointer variable?
What is the purpose of declaring a pointer variable in C?Marks : 1Negative Marks : 0Answer hereTo create a new variable.To store the address of another variable.To perform mathematical operations.All 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
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
What is the correct syntax to declare a pointer in C++?int &ptr;int ptr*;int *ptr;int ptr&;
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.