我有一个程序,旨在将10个整数从一个数组复制到另一个数组.它正在编译而没有任何错误.它如下: -
/* Program to copy a string from one array to another array and print the second array */
#include<stdio.h>
#include<conio.h>
#define MAX 10
void main()
{
int s[MAX]; // Original array
int c[MAX]; // Array which contains the copied contents of s[MAX]
int i;
printf("Enter the string of 10 characters");
for(i=0;i<MAX;i++) // Storing elements in the original array
{
scanf("%d",s[i]);
}
for(i=0;i<MAX;i++)
{
printf("%d",s[i]);
}
printf("\n");
for(i=0;i<MAX;i++) /*Copying the elements from the original array into the duplicate array*/
{
c[i]=s[i];
}
for(i=0;i<MAX;i++) //Printing the duplicate array
{
printf("%d",c[i]);
}
}
Run Code Online (Sandbox Code Playgroud)
它甚至不打印原始阵列.更不用说复制数组,这是程序的后半部分.
| 归档时间: |
|
| 查看次数: |
89 次 |
| 最近记录: |