write a program to generate address labels using structures?



write a program to generate address labels using structures?..

Answer / Sandeep Dixit

Here is a simple example of a C program that generates address labels using structures:

```c
#include <stdio.h>

struct Address {
char street[50];
int house_number;
char city[20];
char state[10];
char zip[10];
};

void printLabel(struct Address address) {
printf("----------------------------------n");
printf("| %s, %dn", address.street, address.house_number);
printf("| %s, %s %sn", address.city, address.state, address.zip);
printf("----------------------------------n");
}

int main() {
struct Address myAddress = {"123 Main Street", 1234, "Cityville", "NY", "12345"};
printLabel(myAddress);
return 0;
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

write a program to gat the digt sum of a number (et. 15= >1+5=6)

2 Answers  


what is the different between if-else and switch statment (other than syntax)

26 Answers   CTS, Oracle, Scorpos,


what is a function method?give example?

1 Answers  


Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

0 Answers   Genpact,


All technical questions

1 Answers   TCS,


how does the for loop work actually..suppose for the following program how it ll work plz explain to me for(i=5;i>=0;i--) prinf(i--);

19 Answers   RMSI,


How to declare a variable?

1 Answers  


Write a programe print the sum of series 0,1,2,.....10

7 Answers  


i want explaination about the program and its stack reprasetaion fibbo(int n) { if(n==1 or n==0) return n; else return fibbo(n-1)+fibbo(n-2); } main() { fibbo(6); }

2 Answers  


What is sizeof return in c?

1 Answers  


What is indirection in c?

1 Answers  


Function calling procedures? and their differences? Why should one go for Call by Reference?

1 Answers   ADP,


Categories