嗨,任何人都可以告诉我这个错误吗?
#include<stdio.h>
int main()
{
char a[]="abcdefgh";
int i=0;
int n=strlen(a);
char *first;
char *second;
char *c;
*first=a[0];
*second=a[7];
for(i=0;i<=n/2;i++)
{
*c=*first;
*first=*second;
*second=*c;
first++;
second--;
}
for(i=0;i<=7;i++)
{
printf("%c",a[i]);
}
}
Run Code Online (Sandbox Code Playgroud) 这个简单的代码可以帮助我吗?
#include <iostream>
using namespace std;
void testFunction(){
cout<<"This is the test function 0"<<endl;
}
void testFunction1(){
cout<<"This is the test function 1"<<endl;
}
void testFunction2(){
cout<<"This is the test function 2"<<endl;
}
void (*fp[])()={testFunction,testFunction1,testFunction2};
int main(){
//fp=testFunction;
(*fp[testFunction1])();
//cout<<"Addrees of the function pointer is:"<<*fp;
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
error: invalid types `void (*[3])()[void ()()]' for array subscript|
Run Code Online (Sandbox Code Playgroud) 在行获取语法错误:
`List<Class> findClasses(File directory)` throws `ClassNotFoundException`...
Run Code Online (Sandbox Code Playgroud)
无法弄清楚原因.这是我的代码.
import org.apache.tools.ant.Task;
import java.util.*;
import java.io.*;
public class CreateTestPackage extends Task
{
String allTestsFile = getProject().getProperty("alltestfiles")+ getProject().getProperty("testfile");
public void execute()
{
List<Class> findClasses(File directory) throws ClassNotFoundException
{
List<Class> classes = new ArrayList<Class>();
if (!directory.exists())
{
return classes;
}
File[] files = directory.listFiles(new FilenameFilter()
{
public boolean accept( File dir, String name )
{
return name.matches("test.*\\.class");
}
});
for (File file : files)
{
if (file.isDirectory())
{
assert !file.getName().contains(".");
classes.addAll(findClasses(file));
}
else if (file.getName().endsWith(".class")) …Run Code Online (Sandbox Code Playgroud) 如何将字符串转换为整数?
对于前:
任何代码都会有所帮助
如何将非结构化数据转换为结构化数据?例如电子邮件联系人,从非结构化文本到结构化格式。
是否有任何算法可以做到这一点?