Q. Determine Output

Code:
void main()
{
      printf("%p", main);
}
  • (A) Error
  • (B) make an infinite loop
  • (C) Some address will be printed
  • (D) None of These
πŸ’¬ Discuss
βœ… Correct Answer: (C) Some address will be printed
Explanation: Function names are just addresses (just like array names are addresses). main() is also a function. So the address of function main will be printed. %p in printf() specifies that the argument is an address. They are printed as hexadecimal numbers.
Explanation by: Rajeev Malhotra
Function names are just addresses (just like array names are addresses). main() is also a function. So the address of function main will be printed. %p in printf() specifies that the argument is an address. They are printed as hexadecimal numbers.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
256
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Rajeev Malhotra
Publisher
πŸ“ˆ
82%
Success Rate