-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
In the following code, what is p2? typedef int* ptr ptr p1, p2;
A) an integer B) an integer pointerC) a pointerD) None of the above
-
-
-
-
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
-
-
printf(" %d", sizeof(u.a));
// printf("%d", sizeof(u.a[4].i));
}
">union u{ union u { int i; int j; }a[10]; int b[10];}u;main(){ printf("n%d", sizeof(u)); printf(" %d", sizeof(u.a));// printf("%d", sizeof(u.a[4].i));}
A) None of the AboveB) 1, 100, 1C) 40, 4, 4D) 4, 4, 4Explanation: 20, 200, error for 3rd printf
-
-
-
-
-
-
-
What is a static function?
A static function is a function whose scope is limited to the current source file. Scope refers to the visibility of a function or variable. If the function or variable is visible outside of the current source file, it is said to have global, or external, scope. If the function or variable is not visible outside of the current source file, it is said to have local, or static, scope.
-
How can I convert a number to a string?
The standard C library provides several functions for converting numbers of all formats (integers, longs, floats, and so on) to strings and vice versa The following functions can be used to convert integers to strings: Function Name Purpose itoa() Converts an integer value to a string. ltoa() Converts a long integer value to a string. ultoa() Converts an unsigned long integer value to a string....