这个程序一直在崩溃,而不是让我输入参数,为什么?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, const char* argv[]) {
int shift = atoi(argv[1]);
char message[256];
strcpy(message, argv[2]);
int i;
for (i = 0; i < strlen(message); i++) {
printf("%c", message[i] + shift);
}
putchar('\n');
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我正在使用代码块.但我也尝试用Notepad ++运行它.在我编译它之后,当我运行它时它只是崩溃:Name.exe已经停止工作.它不应该要求我在命令行输入参数吗?
int m[1000]; //declaring global array
int added(int input){
for(int i=1;i<= input; i++){
if(i>0 && input % 2) // checking if the numbers are even...
m[i]= input; //array implementation
return m[i];
}
}
int main()
{
for(int j=2;j<54;j++){
printf("%d",m[i]);
putchar('\n');
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试从函数返回数组.为什么不工作?在for循环中实现了数组.