Wednesday, May 4, 2016

Structure of Declaring and accessing c 2

#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;
 strcpy(azmalTwo.firstName,"mohammad Azmal");
 strcpy(azmalTwo.lastName,"hossain");
 strcpy(azmalTwo.color,"black");
 azmalTwo.age=25;
 azmalTwo.height=5.2;
 azmalTwo.weight=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 - %f \n weight - %f\n",
       azmalThree.firstName,azmalThree.lastName,azmalThree.color,azmalThree.age,azmalThree.height,azmalThree.weight);
}

No comments:

Post a Comment