+ 1

Printing array

https://code.sololearn.com/cHxOIDt3O63j/?ref=app Iā€™m trying to print the marks entered by the user along with the mod array but canā€™t figure out what to changešŸ˜… to make it work

15th Jan 2019, 9:19 PM
farhan bhatti
farhan bhatti - avatar
2 Answers
+ 1
There a two problems. scanf("%d %d %d",mark); scanf("%d %d %d", &mark[0], &mark[1], &mark[2]); C is a very low level coding language your have to tell c every thing. It wil not understand that mark is a array and that you want to assign the 3 value to 1 array. So you have to give each input it own address. I am not sure what you want to achieve by mixing the value of the nested for loop for(i=0; k<3;k++) { for(k=0; i<3; i++) { If the compiler enter the first iteration of loop i, k is undefined. So it jumps out of the loop and does nothing for(i=0; i<3;i++) { for(k=0; k<3; k++) { } } This works fine.
15th Jan 2019, 9:49 PM
sneeze
sneeze - avatar
0
thanks for the help, ill edit my code, it was one of the problems for my uni C programming test i thought id codešŸ˜…
15th Jan 2019, 10:03 PM
farhan bhatti
farhan bhatti - avatar