Your IP : 216.73.216.40


Current Path : /var/www/html/bibhas.ghoshal/ITP_2019/lab/
Upload File :
Current File : /var/www/html/bibhas.ghoshal/ITP_2019/lab/pointer2strcuture.c

// Pointers to Structures

#include<stdio.h>
#include<string.h>

int main()
{

	struct employee{
		short id;
		char name[30];
		int pay;
	} emp={1024,"Steve",1000}, *p;
	
	p=&emp;
	
	printf("Emp-id:%hd, Name:%s,Pay:%d\n",emp.id,(*p).name,p->pay);
	
	(*p).id = 4201;
	
	strcpy(p->name,"Steve");
	p->pay = 20000;
	
	printf("Emp-id:%hd, Name:%s, Pay:%d\n",p->id,p->name,p->pay);
	
	return 0;
	
}