In C a pointer variable to an integer can be created by the decalarationa.int p*;b.int *p;c.int +p;d.int $p;
Question
In C a pointer variable to an integer can be created by the decalarationa.int p*;b.int *p;c.int +p;d.int $p;
Solution
To create a pointer variable to an integer in C, you can use the following declaration:
a. int *p;
This declaration creates a pointer variable named "p" that can store the memory address of an integer.
b. int *p;
This declaration is also correct and creates a pointer variable named "p" that can store the memory address of an integer.
c. int +p;
This declaration is incorrect. The correct syntax to declare a pointer variable is to use the asterisk (*) before the variable name, not the plus sign (+).
d. int $p;
This declaration is also incorrect. The correct syntax to declare a pointer variable is to use the asterisk (*) before the variable name, not the dollar sign ($).
Similar Questions
Comment on the following pointer declaration.int *ptr, p; ptr is a pointer to integer, p is notptr and p, both are pointers to integerptr is a pointer to integer, p may or may not beptr and p both are not pointers to integer
Select the correct answerWhich of the following is the correct way to declare a pointer to an integer in C?Optionsint *ptr;integer *ptr;ptr *int;point int *ptr;
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
PointersWhat will be the output of the following C code?main() { static int a[ ] = {0, 1, 2, 3, 4}; int *p[ ] = {a, a+1, a+2, a+3, a+4}; int **ptr = p; ptr++; printf("\n %d %d %d", ptr-p, *ptr-a, **ptr); *ptr++; printf("\n %d %d %d", ptr-p, *ptr-a, **ptr); *++ptr; printf("\n %d %d %d", ptr-p, *ptr-a, **ptr); ++*ptr; printf("\n %d %d %d", ptr-p, *ptr-a, **ptr);}Options1 1 12 2 23 3 33 4 41 1 12 2 23 3 34 4 41 1 12 2 24 4 43 3 31 1 12 2 23 3 33 3 3
Comment on the following pointer declaration.int *ptr, p;
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.