这是我的代码:
int main() {
int i=0;
int size=1;
char *pntName=NULL;//a pointer to an array of chars.
pntName = (char*) malloc(size *sizeof(char));//allocate sapce for the first char.
while(pntName[size-1]!=':'){
if(pntName!=NULL)//check the case couldn't allocate
printf("Error");
else{
if(i<size){//meaning there is space for new char.
scanf("%c",&pntName[i]);
i++;
}
else{//case we don't have enough space
size++;
pntName = (char*)realloc(pntName,(size)*sizeof(char));//reallocat space.
scanf("%c",&pntName[i]);
i++;
}
}
}
return 1;
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试读取包含名称的字符串.用户可以输入字符直到他输入':'.我的代码出了什么问题?
我正在尝试编译分为不同包的源代码.我写了一个源文本,并在其中列出了java文件的所有路径.我还制作了一个makefile并写了以下几行:
compile: bin
javac -d bin -cp biuoop-1.4.jar @sources.txt
run:
java -cp biuoop-1.4.jar:bin Ass5Game 2 4
bin:
mkdir bin
Run Code Online (Sandbox Code Playgroud)
biupoop是我正在使用的内置jar文件.
在我使用make commend之后,计算机说:
javac -d bin -cp biuoop-1.4.jar @sources.txt
javac: file not found: animations\Animation.java
Usage: javac <options> <source files>
use -help for a list of possible options
make: *** [compile] Error 2.
Run Code Online (Sandbox Code Playgroud)
我如何编译包中的文件?