Hello There, Guest! RegisterLogin with Facebook
Login with Facebook

Anna University TNEA 2018 Rank List Published. Login to know your Rank.
Anna University April May 2018 Exam Results
Anna University Latest News , Updates and Announcements
>>> Anna University Sixth Semester Question Bank Collection (R2013) ECE,MECH,CSE,IT,EEE,CIVIL,EIE
>>> 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...




Possibly Related Threads...
Thread Author Replies Views Last Post
  GE6151 Computer Programming Frequently Asked C Programs kavi 0 1,593 03-01-2016, 10:35 AM
Last Post: kavi
  Six Visual Basic Programs (Handwritten) Srini 0 823 09-06-2015, 07:35 AM
Last Post: Srini
  [.Net] C# WITH .NET Important Programs with Output for MCA - RBS MTC Srini 0 869 26-01-2014, 10:33 PM
Last Post: Srini
  [.Net] DotNet Important Programs with Output for MCA - RBS MTC Srini 0 1,282 26-01-2014, 09:46 PM
Last Post: Srini
  [HTML] Simple Snake Game Prabakar 2 1,794 17-02-2013, 01:37 PM
Last Post: PHILOMINE SELVARANI
  [PHP] Online Quiz programs Project mohanmo 1 1,631 18-01-2013, 06:07 PM
Last Post: Anna University
  programs for +2 computer science students Anandhakumar 0 1,101 02-11-2012, 03:38 PM
Last Post: Anandhakumar
  programs in c and c++ Anandhakumar 0 830 02-11-2012, 03:36 PM
Last Post: Anandhakumar
  pointers and arrays Anandhakumar 0 745 02-11-2012, 03:28 PM
Last Post: Anandhakumar
  lecture notes two in c++ language with simple questions Anandhakumar 0 858 01-11-2012, 08:20 PM
Last Post: Anandhakumar
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



Vidyarthiplus Whatsapp