Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » BeginnersRSS Feeds

DEFINING, ASSIGNING AND ACCESSING VALUES TO STRUCTURE MEMBERS

Posted By: Raymund Fischer     Category: C Programming     Views: 3037

DEFINING, ASSIGNING AND ACCESSING VALUES TO STRUCTURE MEMBERS.

Code for DEFINING, ASSIGNING AND ACCESSING VALUES TO STRUCTURE MEMBERS in C Programming

struct  personal                                                 
   {
       char  name[20];                                              
       int   day;                                                   
       char  month[10];                                             
       int   year;                                                  
       float salary;                                                
   };                                                               
   main()                                                           
   {
       struct personal person;                                      
       printf("Input Values\n");                                    
       scanf("%s %d %s %d %f",                                      
                 person.name,                                       
                &person.day,                                        
                 person.month,                                      
                &person.year,                                       
                &person.salary);                                    
       printf("%s %d %s %d %f\n",                                   
                 person.name,                                       
                 person.day,                                        
                 person.month,                                      
                 person.year,                                       
                 person.salary);                                    
   } 
                                                               
Output                                                           
   Input Values                                                     
   M.L.Goel 10 January 1945 4500                                    
   M.L.Goel 10 January 1945 4500.00 
  
Share: 



Raymund Fischer
Raymund Fischer author of DEFINING, ASSIGNING AND ACCESSING VALUES TO STRUCTURE MEMBERS is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!