Write a program which performs the following tasks:
− initialize an integer array of 10 elements in main( )
− pass the entire array to a function modify( )
− in modify( ) multiply each element of array by 3
− return the control to main( ) and print the new array elements in main( )
Subscribe to:
Post Comments (Atom)
can u find error of my code? it works but it doesnot multiplies by 3 output is same as input:
ReplyDelete#include
#include
int modify(int *a[10])
{
int i, j, k;
for(i=0;i<=9;i++)
{
k=*a[i];
printf("\n");
j=k*3;
return j;
}
}
main()
{
int *ten[10];
int h;
for(h=0;h<=9;h++)
{
printf("Enter element no.%d of array: ",h);
scanf("%d",&ten[h]);
}
modify(&ten[10]);
for(h=0;h<=9;h++)
{
printf("%d",ten[h]);
}
getch();
}
Brother there are some errors in your code please try to corrext them
ReplyDelete