Knowee
Questions
Features
Study Tools

What is the value of n after the following code is executed?int n = 98;int *p = &n;

Question

What is the value of n after the following code is executed?

int n = 98;
int *p = &n;
🧐 Not the exact question you are looking for?Go ask a question

Solution

The value of n after the following code is executed would still be 98.

Here's the step by step explanation:

  1. int n = 98; This line declares an integer variable n and initializes it with the value 98.

  2. int *p = &n; This line declares a pointer to an integer p and assigns it the address of n. So, p is now pointing to n.

However, no operation is performed to change the value of n after these lines. Therefore, the value of n remains 98.

This problem has been solved

Similar Questions

What will the result of num variable after execution of the following statements? int num = 58; num % = 11; the given code is in c

What is the output of the following code?int arr[] = {1, 2, 3, 4, 5};int *p = arr;p++;printf("%d\n", *p);

How many times is the comparison i >= n performed in the following program?int i = 300, n = 150;main(){ while (i >= n){ i = i-2; n = n+1; }}

write a program to print integer no, from 1 to n where n is the input from the user using do while loop in c language use getch

What will you see on the terminal?int main(void){ int *ptr; *ptr = 98; printf("%d\n", *ptr); return (0);}It doesn’t compileSegmentation Fault980

1/2

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.