当前位置:网站首页>Can we use function pointers in go- Can we have function pointers in Go?
Can we use function pointers in go- Can we have function pointers in Go?
2022-06-25 07:10:00 【French red wine sweet】
problem :
I was learning about pointers in Go. I am learning Go The pointer in .And managed to write something like: And try to write something similar :
func hello(){ fmt.Println("Hello World")}func main(){ pfunc := hello //pfunc is a pointer to the function "hello" pfunc() //calling pfunc prints "Hello World" similar to hello function}
Is there a way to declare the function pointer without defining it as done above? Is there any way to declare a function pointer instead of defining it as above ?Can we write something like we do in C? We can be like C Do you write something like that ?
eg void (*pfunc)(void);
for example void (*pfunc)(void);
Solution :
Reference resources : https://stackoom.com/en/question/F6zU边栏推荐
- Make fertilizer Safi from crop residues locally to increase yield by 30% and improve soil
- StreamNative Platform 1.5 版本发布,集成 Istio、支持 OpenShift 部署
- Derivation of COS (a-b) =cosa*cosb+sina*sinb
- How to record a database [closed] - how to document a database [closed]
- 'how do I create an enumeration with constant values in rust?'- How can I create enums with constant values in Rust?
- ASP. Net core - encrypted configuration in asp NET Core
- MSG_ OOB MSG_ PEEK
- 1W字|40 图|硬核 ES 实战
- How to configure log4j to only keep log files for the last seven days?
- 有了 MySQL 为什么要用 NoSQL?
猜你喜欢
Pratique de gestion hiérarchique basée sur kubesphere
keil debug查看变量提示not in scope
ACWING/2004. Misspelling
Understand ZBrush carving software and game modeling analysis
In depth analysis of Apache bookkeeper series: Part 3 - reading principle
Keil debug view variable prompt not in scope
我们不一样
R & D thinking 07 - embedded intelligent product safety certification required
单片机IO详解(上拉 下拉 准双向 输入 输出 推挽 开漏)
有了 MySQL 为什么要用 NoSQL?
随机推荐
Derivation of COS (a-b) =cosa*cosb+sina*sinb
The upper and lower lines of the shell are merged into one line
ACWING/2004. 錯字
【他字字不提爱,却句句都是爱】
Ctfhub web information disclosure directory traversal
赚够钱回老家吗
The most basic difference between clustering and classification.
Kubernetes core components etcd details
Are these old system codes written by pigs?
基于 KubeSphere 的分级管理实践
Simple and complete steps of vivado project
Kubernetes cluster dashboard & kuboard installation demo
Want to self-study SCM, do you have any books and boards worth recommending?
Three laws of go reflection
[2022 dark horse programmer] SQL optimization
The process of making wooden barrels with 3DMAX software: a three-step process
Torchserve pit avoidance Guide
Design of PWM breathing lamp based on FPGA
Analysis of China's food cold chain logistics, output of quick-frozen noodles and rice products and operation of major enterprises in 2021 [figure]
1W字|40 图|硬核 ES 实战