You declare home name as a global variable on line 40. You then redefine the variable elsewhere, which, according to the rules of scope, will cause the program to look at the name closest to the working code. The one with no information.
Delete the global so that you can use the other home name variables, and change your functions so that they return the variables they change. To do that you have to list the struct name before the function name, both in the prototype and definition. Read more here: Cprogramming.com Tutorial: Functions
There's also no reason to hide small programs in an attachment when you ask things about it:
Code:
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
struct home
{
char fullname[50], address[20];
int age;
};
struct fullinfo
{
struct home name;
};
void function(struct home name)
{
printf("Enter name:");
scanf("%s",&name.fullname);
printf("\nEnter address:");
scanf("%s",&name.address);
printf("\nEnter age:");
scanf("%d",&name.age);
}
void show(struct fullinfo bin)
{
struct home name;
printf("\nName:%s %s",bin.name.fullname);
printf("\nAddress:%s %s",bin.name.address);
printf("Age:%d %d",bin.name.age);
}
int rec( struct fullinfo bin, struct home name)
{
return (strcmp(name.fullname, bin.name.fullname)==0)
&& (strcmp(name.address, bin.name.address)==0)
&& (strcmp(name.age, bin.name.age)==0);
}
struct home name;
void show(struct fullinfo bin);
int rec( struct fullinfo bin, struct home name);
void main()
{
struct home name;
struct fullinfo bin;
int fin;
clrscr();
function(name);
show(bin);
printf("\n1. Edit\n2. Delete \n 3. Exit\n");
printf("Enter Here:");
scanf("%d",&fin);
switch(fin)
{
case 1:
{
function(name);
show(bin);
getch();
}
case 2:
{
printf("\nFullname:");
printf("\nAddress:");
printf("\nAge:");
exit(0);
}
case 3:
{
exit(0);
}
}
getch();
}