Hello There, Guest! RegisterLogin with Facebook
Login with Facebook

New Anna University Nov / Dec 2016 Examination Important Questions
New Anna University (UG / PG) Nov/Dec 2016 and Jan 2017 Theory , Practical Exam Timetable
>>> Anna University Sixth Semester Question Bank Collection (R2013) ECE,MECH,CSE,IT,EEE,CIVIL,EIE
>>> Anna University November/December 2015 Examination Question Papers
>>> Anna University Study Materials for all Departments
>>> Anna University Question Papers : April May June 2015 Question Papers | Nov Dec 2014 and Jan 2015 Question Papers

Register or Login to Submit Study Materials , Shoutbox and also to access Many Features !!

Vidyarthiplus Shop :: Handwritten Premium Lecture Notes
Share your Study Materials with us
Share your Study Materials with us : Click Here

Simple Example Programs for structure union and pointers
#1


Here is the Simple Example Program for structure union and pointers

Program :
Code:
/*PROGRAM FOR UNION*/
#include <stdio.h>
#include <conio.h>
Union techno
{
    int id;
    char nm[50];
}tch;
void main()
{
    clrscr();
    printf("\n\t Enter developer id : ");
    scanf("%d", &tch.id);
    printf("\n\n\t Enter developer name : ");
    scanf("%s", tch.nm);
    printf("\n\n Developer ID : %d", tch.id);//Garbage
    printf("\n\n Developed By : %s", tch.nm);
    getch();
}

/*PROGRAM FOR STRUCTURE*/
#include <stdio.h>
#include <conio.h>
struct comp_info
{
    char nm[100];
    char addr[100];
}info;
void main()
{
    clrscr();
    printf("\n Enter Company Name : ");
    gets(info.nm);
    printf("\n Enter Address : ");
    gets(info.addr);
    printf("\n\n Company Name : %s",info.nm);
    printf("\n\n Address : %s",info.addr);
    getch();
}


/*PROGRAM USING POINTER*/
#include <stdio.h>
#include <conio.h>
void main()
{
    int a=10;
    int *ptr;
    clrscr();
    ptr = &a;
    printf("\n\t Value of a : %d", a);
    scanf("\n\n\t Value of pointer ptr : %d", *ptr);
    printf("\n\n\t Address of pointer ptr : %d", ptr);
    getch();
}

get the best... and reach the best...



Reply
#2

Cool...

New Share your Study Materials with us : Click Here


Reply
#3


thanks for the program bro...

Somesh - V+ Team Junior Moderator - Want for other subjects also? Arrow CLICK HERE


Reply

Subscribe


Recommend on Google