User Tools

Site Tools


cs:c_language:struct_and_typedef_1
Return to Home page

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
cs:c_language:struct_and_typedef_1 [2015/10/28 15:23]
127.0.0.1 external edit
cs:c_language:struct_and_typedef_1 [2019/02/26 14:35] (current)
Line 21: Line 21:
   ​   ​
   The program must:   The program must:
-   - Defines a new data type with name ''​stud_t''​ based on a structure useful to store information about a student. +   - Defines a new data type with name ''​stud_t''​ based on 
-   - The structure (identified in a C program with the keyword ''​struct''​) must contain:+     a structure useful to store information about a student. 
 +   - The structure (identified in a C program with the keyword ''​struct''​) 
 +     must contain:
      - a field ''​number''​ to store the //​identification number// of the student      - a field ''​number''​ to store the //​identification number// of the student
-     - a field ''​name''​ to store the //name// of the student (the student name has a maximum length of 20 characters)+     - a field ''​name''​ to store the //name// of the student ​ 
 +       (the student name has a maximum length of 20 characters)
      - a field ''​average''​ to store the average value of the scores of a student      - a field ''​average''​ to store the average value of the scores of a student
      - a vector of ''​scores''​ to store the scores of the exams attended by the student      - a vector of ''​scores''​ to store the scores of the exams attended by the student
-   - The program, after declaring a vector (whose elements are of type ''​stud_t''​) useful to store the data related to ''​N_STUD''​ students. +   - The program, after declaring a vector (whose elements are of type ''​stud_t''​) 
-   - It must fill all the fields related to the student with index ''​0''​ in the vector of type ''​stud_t''​. +     useful to store the data related to ''​N_STUD''​ students. 
-   - And finally, it must print all the fields related to the student with index ''​0''​ previously inserted.+   - It must fill all the fields related to the student with index ''​0''​ 
 +     in the vector of type ''​stud_t''​. 
 +   - And finally, it must print all the fields related to the student 
 +     with index ''​0''​ previously inserted.
 */ */
  
Line 53: Line 59:
   int i;   int i;
   ​   ​
-  /* Filling of the fields of the structure referred to the student index with index 0 of the vector */+  /* Filling of the fields of the structure referred to the student 
 +     index with index 0 of the vector */
   strcpy(student[0].name,​ "​Jules"​);​   strcpy(student[0].name,​ "​Jules"​);​
   student[0].number = 13123;   student[0].number = 13123;

If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at] skenz.it

You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/cs/c_language/struct_and_typedef_1?rev=1551188114&do=diff
/web/htdocs/www.skenz.it/home/data/pages/cs/c_language/struct_and_typedef_1.txt · Last modified: 2019/02/26 14:35 (external edit)

Privacy Policy