ที่นี่เราจะดูว่า __func__ C.
. คืออะไรโดยทั่วไป __func__ หรือ __FUNCTION__ (เวอร์ชันเก่าของ C และ C+ + รองรับ __func__) มาโครนี้ใช้เพื่อรับชื่อของฟังก์ชันปัจจุบัน
ตัวอย่าง
#include<stdio.h>
void TestFunction(){
printf("Output of __func__ is: %s\n", __func__ );
}
main() {
printf("Output of __func__ is: %s\n", __func__ );
TestFunction();
} ผลลัพธ์
Output of __func__ is: main Output of __func__ is: TestFunction