-
strcpy(obj->pAddress, "Your Address");
free(obj);
printf("%s", obj->pName);
printf("%s", obj->pAddress);
}
">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 NameB) Your Address, Your AddressC) Your Name, Your AddressD) None of the aboveExplanation: Prints Nothing, as after free(obj), no memory is there containing obj->pName & pbj->pAddress
-
-
-
-
-
> (i - (i -1))));
}
}
">Main(){ signed int bit=512, i=5; for(;i;i--) { printf("%dn", bit = (bit >> (i - (i -1)))); }}
A) 128, 64, 32, 16, 8B) 256, 128, 64, 32, 16C) 512, 256, 128, 64, 32D) 64, 32, 16, 8, 4
-
-
-
-
-
-
-
-
C program for command line argument
Write c program to accepts file name at command line argument and coverts all characters in the file to uppercase ?
-
-
Output of these programs.
c
struct Foo
{
char *pName;
};
main()
{
struct Foo *obj = malloc(sizeof(struct Foo));
clrscr();
strcpy(obj->pName,"Your Name");
printf("%s", obj->pName);
}
a. Your Name
b. compile error
c. Name
d. Runtime error
c
struct Foo
{
char *pName;
char *pAddress;
}; -
Ans