我是一个小新手,指针仍然给我带来麻烦.我想改变函数中int从参数(作为指针)得到的值.
#include <stdio.h>
bool function(int* a){
a++;
printf("%d",*a); //getting some big number, maybe address. If i did not use a++; I get just normal a, unchanged.
return false;
}
Run Code Online (Sandbox Code Playgroud) 我有一个不寻常的问题.让我们想象一下我有N个功能:
void function1(){ //some code here }
void function2(){ //some code here }
...
void functionN(){ //some code here }
Run Code Online (Sandbox Code Playgroud)
有没有办法,我可以动态地计算或找出哪个函数,没有IF语句?并根据功能名称的名称,调用它?让我告诉你伪代码,可以更好地描述情况:
for(int I=1;I<=N;I++){
functionI();
}
Run Code Online (Sandbox Code Playgroud)
我的意思是,如果它在某种程度上可以计算(例如在char数组中,但也可以通过任何其他方式)代码,我将在稍后插入和使用.但不是字符串,而是直接像代码.让我演示一下不同的例子:
int num=3;
char functionInString[]="printf(num);
//Some code, that would for example change letters in
functionInString, for example to different fuction
consisting of letters
//And here, do whatever is written in functionToString
Run Code Online (Sandbox Code Playgroud)
对不起,如果我不够清楚.任何人都可以告诉我,如果有可能用C语言,或任何不同的语言,这个概念怎么称呼?