डाउनलोड पी.डी.एफ. ई-बुक्स
C - Structure And Pointer

विवरण :

कोई विवरण नहीं है |


सोर्स कोड :

#include <stdio.h>
#include <conio.h>

struct Employee{
   int emp_id;
   float emp_salary;
};
void main(){
    struct Employee *ptr,p;
    
    ptr=&p;
            
    printf("Enter Employee id: ");
    scanf("%d",&(*ptr).emp_id);
    printf("
Enter Employee salary: ");
    scanf("%f",&(*ptr).emp_salary);
    printf("
Employee id is %d",(*ptr).emp_id);
    printf("
Employee salary is %f",(*ptr).emp_salary);
    
getch ();
}

आउटपुट :

Enter Employee id  : 2
Enter Employee salary : 20000

Employee id is 2
Employee salary is 20000.000000