struct Foo
{
char *pName;
char *pAddress;
};
main()
{
struct Foo *obj = malloc(sizeof(struct Foo));
clrscr();
obj->pName = malloc(100);
obj->pAddress = malloc(100);
strcpy(obj->pName,"Your Name");
strcpy(obj->pAddress, "Your Address");
free(obj);
printf("%s", obj->pName);
printf("%s", obj->pAddress);
}
a. Your Name, Your Address
b. Your Address, Your Address
c. Your Name Your Name
d. None of the above
Answers were Sorted based on User's Feedback
Answer / guest
d) printd Nothing, as after free(obj), no memory is there
containing
obj->pName & pbj->pAddress
Is This Answer Correct ? | 6 Yes | 1 No |
Answer / sankara subramanian.n
ya, free(ob); mean free(delete) a previous block of memory .so structure contained item has been deleted
Is This Answer Correct ? | 1 Yes | 2 No |
#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d..%d",*p,*q); }
main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }
Display the time of the system and display the right time of the other country
void main() { int x,y=2,z; z=(z*=2)+(x=y=z); printf("%d",z); }
why java is platform independent?
Sir... please give some important coding questions asked by product companies..
#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }
main() { int y; scanf("%d",&y); // input given is 2000 if( (y%4==0 && y%100 != 0) || y%100 == 0 ) printf("%d is a leap year"); else printf("%d is not a leap year"); }
main() { int i; float *pf; pf = (float *)&i; *pf = 100.00; printf("\n %d", i); } a. Runtime error. b. 100 c. Some Integer not 100 d. None of the above
write a origram swaoing valu without 3rd variable
main( ) { int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}}; printf(ā%u %u %u %d \nā,a,*a,**a,***a); printf(ā%u %u %u %d \nā,a+1,*a+1,**a+1,***a+1); }
How we will connect multiple client ? (without using fork,thread)