void main()
{
int *i = 0x400; // i points to the address 400
*i = 0; // set the value of memory location pointed by i;
}
Answers were Sorted based on User's Feedback
Answer / amit kumar kunwar
as i is pointing to the address 400 and getting assigned a value of 0. this code is working perfectly. hence the Output is 0 for this code.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / susie
Answer :
Undefined behavior
Explanation:
The second statement results in undefined behavior because
it points to some location whose value may not be available
for modification. This type of pointer in which the
non-availability of the implementation of the referenced
location is known as 'incomplete type'.
Is This Answer Correct ? | 0 Yes | 1 No |
main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above
main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }
What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }
How can i find first 5 natural Numbers without using any loop in c language????????
What is the output of the program given below main() { signed char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 b. 2, 100 c. 4, 100 d. 4, 4
18 Answers HCL, IBM, Infosys, LG Soft, Satyam,
main() { show(); } void show() { printf("I'm the greatest"); }
#define prod(a,b) a*b main() { int x=3,y=4; printf("%d",prod(x+2,y-1)); }
respected sir, i did my MCA in 2013 when i am going to attend to an interview i was asked about my project how will i explain my project could please help me in this and my project title is "Social Networking Site For Social Responsibility"
main() { int i =10, j = 20; clrscr(); printf("%d, %d, ", j-- , --i); printf("%d, %d ", j++ , ++i); } a. 20, 10, 20, 10 b. 20, 9, 20, 10 c. 20, 9, 19, 10 d. 19, 9, 20, 10
# include<stdio.h> aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2](); }
1. const char *a; 2. char* const a; 3. char const *a; -Differentiate the above declarations.