0
about structure
https://code.sololearn.com/cVXYBjH91u3r/#c i could add names and print it, but couldnt to for age and height. so correct my code. and tell where i have made mistakes
7 odpowiedzi
+ 1
https://code.sololearn.com/c1MVftnsAJ1y/?ref=app
you can check this by the way
+ 1
You have an array with 10 elements, valid index for an array with 10 elements are from 0 up to 9. In your code, you start saving data from index 1 to <n>. This means the first element is not getting any data. And it can cause problem when <n> is greater or equal to 10, because your array only has 10 elements.
Just letting you know ...
0
May i ask you,what is your input?
and expected output please
0
input: number of entries for different persons
eq-im gonna store and display 2 entries
1. name: raja
age:35
height:6.1
2. name: rakesh
age:40
height:5.5
then display it in the same order
0
yes 1 min i am testing it
0
i found the solution
printf("Enter his/hers age: ");
scanf("%d",temp[i].age);// scanf("%d",&temp[i].age);
printf("Enter his/hers height: ");
scanf("%f",temp[i].height);// scanf("%f",&temp[i].height);
i forget to add '&' symbol in scanf
thanks for your help
0
yes..obviouly