Wednesday, May 4, 2016

Structure of Declaring and accessing C

#include <stdio.h>
#include <stdlib.h>
#define size 50
    struct azmalOne{
    char firstName[size];
    char lastName[size];
    char color[size];
    int age;
    float height;
    float weight;
    };
void azmalprint(struct azmalOne azmalThree);
int main(){
     struct azmalOne azmalTwo={"mohammad Azmal","hossain","black",31,1.72,57};
     azmalprint(azmalTwo);

    return 0;
}
void azmalprint(struct azmalOne azmalThree){
    printf("first name - %s\n last name - %s\n color - %s\n age - %d \n height - %.2f meter \n weight - %.2f kg\n",
           azmalThree.firstName,azmalThree.lastName,azmalThree.color,azmalThree.age,azmalThree.height,azmalThree.weight);
}

No comments:

Post a Comment