#include<stdio.h>
int main(){
int i=10;
int *ptr=&i;
*ptr=(int *)20;
printf("%d",i);
return 0;
}
Output: 20
can anyone explain how came the output is 20
Answer / Girish Singh Gobari
The output is 20 because the integer pointer (ptr) is assigned a new memory address that contains the value 20. When the printf function is called with i as an argument, it displays the value stored at the address i points to, which is now 20.
| Is This Answer Correct ? | 0 Yes | 0 No |
Software Interview Questions
What is the purpose of clrscr () printf () and getch ()?
write a program to create a sparse matrix using dynamic memory allocation.
Write a program to generate prime factors of a given integer?
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
What are static variables, and where are they stored?
Explain data types & how many data types supported by c?
What is define directive?
please give me answer with details #include<stdio.h> main() { int i=1; i=(++i)*(++i)*(++i); printf("%d",i); getch(); }
What is meant by high-order and low-order bytes?
Write a program to compare two strings without using the strcmp() function
42 Answers Accenture, Arba Minch University,
what is pointer ? what is the use of pointer?