Passing Structure Variable to functions

It can be immediately realized that to pass individual elements would become more tedious as the number of structure elements go on increasing. A better way would be to pass the entire structure variable at a time.


#include <stdio.h>
// Global declaration of structure because in other functions it's not available
struct address {
	char phone[15];
	char city[25];
	int pin;

int main() {
	struct address e = { "563269", "New York", 2365 };
	return 0;

int display(struct address ab) {
	printf("\nPhone = %s city = %s pin = %d",,,;
	return 0;

You may also like...