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 |
Is it possible to print a name without using commas, double quotes,semi-colons?
main() { extern i; printf("%d\n",i); { int i=20; printf("%d\n",i); } }
main() { float f=5,g=10; enum{i=10,j=20,k=50}; printf("%d\n",++k); printf("%f\n",f<<2); printf("%lf\n",f%g); printf("%lf\n",fmod(f,g)); }
WAP to display 1,2,3,4,5........N
create a login program that ask username and password. if you input username or password 3 times wrong, the program will terminate else the program will prompt a message "congratulations"
programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h
program to Reverse a linked list
12 Answers Aricent, Microsoft, Ness Technologies,
main() { int x=5; clrscr(); for(;x<= 0;x--) { printf("x=%d ", x--); } } a. 5, 3, 1 b. 5, 2, 1, c. 5, 3, 1, -1, 3 d. –3, -1, 1, 3, 5
Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange
how can i search an element in an array
2 Answers CTS, Microsoft, ViPrak,
What are the files which are automatically opened when a C file is executed?
How can you relate the function with the structure? Explain with an appropriate example.