SlideShare a Scribd company logo
C Programming - Pointers

Organized By: Vinay Arora
               Assistant Professor, CSED
               Thapar University, Patiala
Program - 1
 #include<stdio.h>                                   void swapr(int x, int y)
 #include<conio.h>                                    {
 void swapr(int,int);                                  int t;
 int main()                                            t=x;
  {                                                    x=y;
   int a=10,b=20;                                      y=t;
   clrscr();                                          }

  printf("Value of variable a=%d and b=%d",a,b);
  swapr(a,b);
  printf("nValue of variable a=%d and b=%d",a,b);

   getch();
  }




                                    Vinay Arora
                                       CSED
Program – 1 (output)




                Vinay Arora
                   CSED
Program - 2
 #include<stdio.h>                                   void swapr(int *x, int *y)
 #include<conio.h>                                    {
 void swapr(int *, int *);                             int t;
 int main()                                            t=*x;
  {                                                    *x=*y;
   int a=10,b=20;                                      *y=t;
   clrscr();                                          }

  printf("Value of variable a=%d and b=%d",a,b);
  swapr(&a,&b);
  printf("nValue of variable a=%d and b=%d",a,b);

   getch();
  }



                                     Vinay Arora
                                        CSED
Program – 2 (output)




                Vinay Arora
                   CSED
Program - 3
  #include<stdio.h>                                    void areaperi(int r, float *a, float *p)
  #include<conio.h>                                      {
  void areaperi(int,float *,float *);                     *a=3.14*r*r;
  int main()
                                                          *p=2*3.14*r;
   {
    int radius;                                          }
    float area, perimeter;
    clrscr();

   printf("Enter radius of circle");
   scanf("%d",&radius);

    areaperi(radius,&area,&perimeter);

   printf("Area=%fn",area);
   printf("Perimeter=%fn",perimeter);
   return 0;

   }
                                         Vinay Arora
                                            CSED
Program – 3 (output)




                Vinay Arora
                   CSED
Passing Array Value (CBVal)




                Vinay Arora
                   CSED
Passing Array Reference (CBRef)




                Vinay Arora
                   CSED
Vinay Arora
   CSED
Program - 4
        #include<stdio.h>
        #include<conio.h>
        void main()
         {
          int i, *x;
          clrscr();

         printf("Enter any Integer Valuet");
         scanf("%d",&i);

         x=&i;
         printf("nx=Address value of in");
         printf("nValue of x = %u",x);
         x++;
         printf("nAfter Increment in Pointern");
         printf("Value of x = %u",x);

          getch();
         }

                            Vinay Arora
                               CSED
Program – 4 (output)




                Vinay Arora
                   CSED
Program - 5
        #include<stdio.h>
        #include<conio.h>

        void main()
         {
          int a=10, b=20, *p, *j;

         clrscr();

         p=&a;
         j=&b;

         printf("nAddition *p + b = %d", *p + b);
         printf("nAddition *p + *j = %d", *p + *j);
         printf("nAddition *(p) + *(j) = %d", *(p) + *(j));
         printf("nAddition *(&a) + *(&b) = %d", *(&a) + *(&b));

          getch();
         }
                               Vinay Arora
                                  CSED
Program – 5 (output)




                Vinay Arora
                   CSED
Program - 6
  #include<stdio.h>
  #include<conio.h>                             printf("nj - i = %d",j-i);
                                                printf("n*j - *i =%d",*j - *i);
  void main()
   {                                            getch();
    int arr[]={10,20,30,45,67,56,74};           }
    int *i,*j;
    int x;

   clrscr();

   printf("Array Elements are");
   for(x=0;x<=6;x++)
    {
     printf("n Value at arr[%d] is %d",x,arr[x]);
    }

   i=&arr[1];
   j=&arr[5];

                                        Vinay Arora
                                           CSED
Program – 6 (output)




                Vinay Arora
                   CSED
Program - 7
  #include<stdio.h>                                   for(i=0;i<=5;i++)
  #include<conio.h>                                     {
                                                         printf("nAddress = %u",j);
  void main()                                            printf("nElement = %d",*j);
   {                                                     j++;
    int num[]={24,34,12,44,56,17};                      }
    int i,*j;
                                                        getch();
   clrscr();                                           }

   printf("Array Elements are");
   for(i=0;i<=5;i++)
    {
     printf("n Value at arr[%d] is %d",i,num[i]);
    }

   j=&num[0];


                                        Vinay Arora
                                           CSED
Program – 7 (output)




                Vinay Arora
                   CSED
Program – 8 (Diff. notations for accessing Array)

    #include<stdio.h>                                getch();
    #include<conio.h>                                 }

    void main()
     {
      int num[]={24,34,12};
      int i;

     clrscr();

     printf("Array Elements are");
     for(i=0;i<=2;i++)
      {
       printf("n Value at arr[%d] is %d",i,num[i]);
       printf("n Value at arr[%d] is %d",i,i[num]);
       printf("n Value at arr[%d] is %d",i,*(num+i));
       printf("n Value at arr[%d] is %d",i,*(i+num));
       printf("n");
      }
                                       Vinay Arora
                                          CSED
Program – 8 (output)




                Vinay Arora
                   CSED
Program - 9
         #include<stdio.h>
         #include<conio.h>

         void main()
          {
           int s[3][2]={
                                  {10,15},
                                  {20,25},
                                  {30,35}
                           };
          int i;
          clrscr();

          for(i=0;i<=2;i++)
           printf("Address of %dth 1-D array = %un",i,s[i]);

           getch();
          }

                                Vinay Arora
                                   CSED
Program – 9 (output)




                Vinay Arora
                   CSED
Program – 10 (Conti…)

  #include<stdio.h>                           printf("Notation Used is s[i][j])n");
  #include<conio.h>                            for(i=0;i<=2;i++)
  void main()                                   {
   {                                             for(j=0;j<=1;j++)
    int s[3][2]={                                {
                      {10,15},                    printf("t%d",s[i][j]);
                      {20,25},                   }
                      {30,35}                   printf("n");
               };                               }
   int i,j;
   clrscr();                                       getch();
   printf("Array Elements aren");           }




                                     Vinay Arora
                                        CSED
Program – 10 (Conti…)

  #include<stdio.h>                 printf("nAccessing 2-D Arrayn");
  #include<conio.h>                  printf("Notation Used is *(s[i]+j)n");
  void main()                        for(i=0;i<=2;i++)
   {                                  {
    int s[3][2]={                      for(j=0;j<=1;j++)
                      {10,15},         {
                      {20,25},          printf("t%d",*(s[i]+j));
                      {30,35}          }
               };                     printf("n");
   int i,j;                           }
   clrscr();
                                   getch();
                                    }




                                 Vinay Arora
                                    CSED
Program – 10 (Conti…)

  #include<stdio.h>                printf("nAccessing 2-D Arrayn");
  #include<conio.h>                  printf("Notation Used is
  void main()                      *(*(s+i)+j)n");
   {                                 for(i=0;i<=2;i++)
    int s[3][2]={                     {
                      {10,15},         for(j=0;j<=1;j++)
                      {20,25},         {
                      {30,35}           printf("t%d",*(*(s+i)+j));
               };                      }
   int i,j;                           printf("n");
   clrscr();                          }
                                     getch();
                                    }




                                 Vinay Arora
                                    CSED
Program – 10 (output)




                Vinay Arora
                   CSED
Program – 11 (Array of Pointer)
 #include<stdio.h>             printf("Address of variable a,b,cn");
 #include<conio.h>               printf("%un",a);
                                 printf("%un",b);
 void main()                     printf("%un",c);
  {
    int *arr[3];                printf("Value Present in Arrayn");
    int i=10, j=20, k=30, m;    for(m=0;m<=2;m++)
    int *a,*b,*c;                {
                                 printf("n%u",arr[m]);
   clrscr();                     }

                                printf("n");                      printf("n");
   arr[0] = &i;                                                       for(m=0;m<=2;m++)
   arr[1] = &j;                 for(m=0;m<=2;m++)
                                 {                                     {
   arr[2] = &k;                                                        printf("n%d",*(arr[m]));
                                 printf("n%u",&arr[m]);
                                 }                                     }
   a=&i;                                                             getch();
   b=&j;                                                            }
   c=&k;

                                          Vinay Arora
                                             CSED
Program – 11 (output)




                Vinay Arora
                   CSED
Thnx…



  Vinay Arora
     CSED

More Related Content

What's hot (20)

Pointer in C++
Pointer in C++Pointer in C++
Pointer in C++
 
Learning C++ - Pointers in c++ 2
Learning C++ - Pointers in c++ 2Learning C++ - Pointers in c++ 2
Learning C++ - Pointers in c++ 2
 
Lecturer23 pointersin c.ppt
Lecturer23 pointersin c.pptLecturer23 pointersin c.ppt
Lecturer23 pointersin c.ppt
 
Pointers in C
Pointers in CPointers in C
Pointers in C
 
Pointers+(2)
Pointers+(2)Pointers+(2)
Pointers+(2)
 
Pointers in C/C++ Programming
Pointers in C/C++ ProgrammingPointers in C/C++ Programming
Pointers in C/C++ Programming
 
Pointer in C
Pointer in CPointer in C
Pointer in C
 
Pointer in C
Pointer in CPointer in C
Pointer in C
 
Used of Pointer in C++ Programming
Used of Pointer in C++ ProgrammingUsed of Pointer in C++ Programming
Used of Pointer in C++ Programming
 
C pointers
C pointersC pointers
C pointers
 
Ponters
PontersPonters
Ponters
 
Ch5 array nota
Ch5 array notaCh5 array nota
Ch5 array nota
 
Pointer in c program
Pointer in c programPointer in c program
Pointer in c program
 
Pointers in c++ by minal
Pointers in c++ by minalPointers in c++ by minal
Pointers in c++ by minal
 
Pointers in C
Pointers in CPointers in C
Pointers in C
 
Pointers (Pp Tminimizer)
Pointers (Pp Tminimizer)Pointers (Pp Tminimizer)
Pointers (Pp Tminimizer)
 
Pointers in C
Pointers in CPointers in C
Pointers in C
 
Presentation on pointer.
Presentation on pointer.Presentation on pointer.
Presentation on pointer.
 
Arrays
ArraysArrays
Arrays
 
8 Pointers
8 Pointers8 Pointers
8 Pointers
 

Viewers also liked

INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGAbhishek Dwivedi
 
C Tutorial
C TutorialC Tutorial
C Tutorialbiochelo
 
C Prog. - Structures
C Prog. - StructuresC Prog. - Structures
C Prog. - Structuresvinay arora
 
Pointers in c
Pointers in cPointers in c
Pointers in cMohd Arif
 
C Prog. - Data Types, Variables and Constants
C Prog. - Data Types, Variables and ConstantsC Prog. - Data Types, Variables and Constants
C Prog. - Data Types, Variables and Constantsvinay arora
 
C Prog. - ASCII Values, Break, Continue
C Prog. -  ASCII Values, Break, ContinueC Prog. -  ASCII Values, Break, Continue
C Prog. - ASCII Values, Break, Continuevinay arora
 
C Prog - Functions
C Prog - FunctionsC Prog - Functions
C Prog - Functionsvinay arora
 
C Prog. - Strings (Updated)
C Prog. - Strings (Updated)C Prog. - Strings (Updated)
C Prog. - Strings (Updated)vinay arora
 
C Prog. - Decision & Loop Controls
C Prog. - Decision & Loop ControlsC Prog. - Decision & Loop Controls
C Prog. - Decision & Loop Controlsvinay arora
 
CG - Introduction to Computer Graphics
CG - Introduction to Computer GraphicsCG - Introduction to Computer Graphics
CG - Introduction to Computer Graphicsvinay arora
 
Search engine and web crawler
Search engine and web crawlerSearch engine and web crawler
Search engine and web crawlervinay arora
 
C programming pointer
C  programming pointerC  programming pointer
C programming pointerargusacademy
 

Viewers also liked (20)

Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
Pointers in c
Pointers in cPointers in c
Pointers in c
 
C Prog - Array
C Prog - ArrayC Prog - Array
C Prog - Array
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
C Tutorial
C TutorialC Tutorial
C Tutorial
 
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorial
 
C Prog. - Structures
C Prog. - StructuresC Prog. - Structures
C Prog. - Structures
 
Pointers in c
Pointers in cPointers in c
Pointers in c
 
C Prog. - Data Types, Variables and Constants
C Prog. - Data Types, Variables and ConstantsC Prog. - Data Types, Variables and Constants
C Prog. - Data Types, Variables and Constants
 
C Prog. - ASCII Values, Break, Continue
C Prog. -  ASCII Values, Break, ContinueC Prog. -  ASCII Values, Break, Continue
C Prog. - ASCII Values, Break, Continue
 
C Prog - Functions
C Prog - FunctionsC Prog - Functions
C Prog - Functions
 
C Prog. - Strings (Updated)
C Prog. - Strings (Updated)C Prog. - Strings (Updated)
C Prog. - Strings (Updated)
 
C programming slide-6
C programming slide-6C programming slide-6
C programming slide-6
 
C Prog. - Decision & Loop Controls
C Prog. - Decision & Loop ControlsC Prog. - Decision & Loop Controls
C Prog. - Decision & Loop Controls
 
Pointers C programming
Pointers  C programmingPointers  C programming
Pointers C programming
 
CG - Introduction to Computer Graphics
CG - Introduction to Computer GraphicsCG - Introduction to Computer Graphics
CG - Introduction to Computer Graphics
 
Pointers
PointersPointers
Pointers
 
Search engine and web crawler
Search engine and web crawlerSearch engine and web crawler
Search engine and web crawler
 
C programming pointer
C  programming pointerC  programming pointer
C programming pointer
 

Similar to C Prog - Pointers

Similar to C Prog - Pointers (20)

Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
C Prog - Strings
C Prog - StringsC Prog - Strings
C Prog - Strings
 
C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
Srinivas Reddy Amedapu C and Data Structures JNTUH Hyderabad
Srinivas Reddy Amedapu C and Data Structures JNTUH HyderabadSrinivas Reddy Amedapu C and Data Structures JNTUH Hyderabad
Srinivas Reddy Amedapu C and Data Structures JNTUH Hyderabad
 
Srinivas Reddy Amedapu, CPDS, CP Lab, JNTU Hyderabad
Srinivas Reddy Amedapu, CPDS, CP Lab, JNTU HyderabadSrinivas Reddy Amedapu, CPDS, CP Lab, JNTU Hyderabad
Srinivas Reddy Amedapu, CPDS, CP Lab, JNTU Hyderabad
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
 
C basics
C basicsC basics
C basics
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C Programs
 
C lab manaual
C lab manaualC lab manaual
C lab manaual
 
Ejercicios de programacion
Ejercicios de programacionEjercicios de programacion
Ejercicios de programacion
 
Pnno
PnnoPnno
Pnno
 
C lab excellent
C lab excellentC lab excellent
C lab excellent
 
C and Data Structures Lab Solutions
C and Data Structures Lab SolutionsC and Data Structures Lab Solutions
C and Data Structures Lab Solutions
 
C and Data Structures
C and Data Structures C and Data Structures
C and Data Structures
 
C Prog - Array
C Prog - ArrayC Prog - Array
C Prog - Array
 
C Programming Language Part 8
C Programming Language Part 8C Programming Language Part 8
C Programming Language Part 8
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
SaraPIC
SaraPICSaraPIC
SaraPIC
 

More from vinay arora

Use case diagram (airport)
Use case diagram (airport)Use case diagram (airport)
Use case diagram (airport)vinay arora
 
Use case diagram
Use case diagramUse case diagram
Use case diagramvinay arora
 
Lab exercise questions (AD & CD)
Lab exercise questions (AD & CD)Lab exercise questions (AD & CD)
Lab exercise questions (AD & CD)vinay arora
 
SEM - UML (1st case study)
SEM - UML (1st case study)SEM - UML (1st case study)
SEM - UML (1st case study)vinay arora
 
4 java - decision
4  java - decision4  java - decision
4 java - decisionvinay arora
 
3 java - variable type
3  java - variable type3  java - variable type
3 java - variable typevinay arora
 
2 java - operators
2  java - operators2  java - operators
2 java - operatorsvinay arora
 
1 java - data type
1  java - data type1  java - data type
1 java - data typevinay arora
 
Security & Protection
Security & ProtectionSecurity & Protection
Security & Protectionvinay arora
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process Synchronizationvinay arora
 
CG - Output Primitives
CG - Output PrimitivesCG - Output Primitives
CG - Output Primitivesvinay arora
 
CG - Display Devices
CG - Display DevicesCG - Display Devices
CG - Display Devicesvinay arora
 
CG - Input Output Devices
CG - Input Output DevicesCG - Input Output Devices
CG - Input Output Devicesvinay arora
 
A&D - Object Oriented Design using UML
A&D - Object Oriented Design using UMLA&D - Object Oriented Design using UML
A&D - Object Oriented Design using UMLvinay arora
 
A&D - Input Design
A&D - Input DesignA&D - Input Design
A&D - Input Designvinay arora
 

More from vinay arora (20)

Use case diagram (airport)
Use case diagram (airport)Use case diagram (airport)
Use case diagram (airport)
 
Use case diagram
Use case diagramUse case diagram
Use case diagram
 
Lab exercise questions (AD & CD)
Lab exercise questions (AD & CD)Lab exercise questions (AD & CD)
Lab exercise questions (AD & CD)
 
SEM - UML (1st case study)
SEM - UML (1st case study)SEM - UML (1st case study)
SEM - UML (1st case study)
 
6 java - loop
6  java - loop6  java - loop
6 java - loop
 
4 java - decision
4  java - decision4  java - decision
4 java - decision
 
3 java - variable type
3  java - variable type3  java - variable type
3 java - variable type
 
2 java - operators
2  java - operators2  java - operators
2 java - operators
 
1 java - data type
1  java - data type1  java - data type
1 java - data type
 
Uta005 lecture3
Uta005 lecture3Uta005 lecture3
Uta005 lecture3
 
Uta005 lecture1
Uta005 lecture1Uta005 lecture1
Uta005 lecture1
 
Uta005 lecture2
Uta005 lecture2Uta005 lecture2
Uta005 lecture2
 
Security & Protection
Security & ProtectionSecurity & Protection
Security & Protection
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process Synchronization
 
CG - Output Primitives
CG - Output PrimitivesCG - Output Primitives
CG - Output Primitives
 
CG - Display Devices
CG - Display DevicesCG - Display Devices
CG - Display Devices
 
CG - Input Output Devices
CG - Input Output DevicesCG - Input Output Devices
CG - Input Output Devices
 
A&D - UML
A&D - UMLA&D - UML
A&D - UML
 
A&D - Object Oriented Design using UML
A&D - Object Oriented Design using UMLA&D - Object Oriented Design using UML
A&D - Object Oriented Design using UML
 
A&D - Input Design
A&D - Input DesignA&D - Input Design
A&D - Input Design
 

Recently uploaded

How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsCol Mukteshwar Prasad
 
Advances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdfAdvances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdfDr. M. Kumaresan Hort.
 
Forest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFForest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFVivekanand Anglo Vedic Academy
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfTamralipta Mahavidyalaya
 
Accounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfAccounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfYibeltalNibretu
 
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...Denish Jangid
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXMIRIAMSALINAS13
 
NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxssuserbdd3e8
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345beazzy04
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringDenish Jangid
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPCeline George
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptxmansk2
 
Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxShibin Azad
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...Sayali Powar
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersPedroFerreira53928
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfPo-Chuan Chen
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfjoachimlavalley1
 

Recently uploaded (20)

How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Advances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdfAdvances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdf
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Forest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFForest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDF
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Accounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfAccounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdf
 
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptx
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 

C Prog - Pointers

  • 1. C Programming - Pointers Organized By: Vinay Arora Assistant Professor, CSED Thapar University, Patiala
  • 2. Program - 1 #include<stdio.h> void swapr(int x, int y) #include<conio.h> { void swapr(int,int); int t; int main() t=x; { x=y; int a=10,b=20; y=t; clrscr(); } printf("Value of variable a=%d and b=%d",a,b); swapr(a,b); printf("nValue of variable a=%d and b=%d",a,b); getch(); } Vinay Arora CSED
  • 3. Program – 1 (output) Vinay Arora CSED
  • 4. Program - 2 #include<stdio.h> void swapr(int *x, int *y) #include<conio.h> { void swapr(int *, int *); int t; int main() t=*x; { *x=*y; int a=10,b=20; *y=t; clrscr(); } printf("Value of variable a=%d and b=%d",a,b); swapr(&a,&b); printf("nValue of variable a=%d and b=%d",a,b); getch(); } Vinay Arora CSED
  • 5. Program – 2 (output) Vinay Arora CSED
  • 6. Program - 3 #include<stdio.h> void areaperi(int r, float *a, float *p) #include<conio.h> { void areaperi(int,float *,float *); *a=3.14*r*r; int main() *p=2*3.14*r; { int radius; } float area, perimeter; clrscr(); printf("Enter radius of circle"); scanf("%d",&radius); areaperi(radius,&area,&perimeter); printf("Area=%fn",area); printf("Perimeter=%fn",perimeter); return 0; } Vinay Arora CSED
  • 7. Program – 3 (output) Vinay Arora CSED
  • 8. Passing Array Value (CBVal) Vinay Arora CSED
  • 9. Passing Array Reference (CBRef) Vinay Arora CSED
  • 10. Vinay Arora CSED
  • 11. Program - 4 #include<stdio.h> #include<conio.h> void main() { int i, *x; clrscr(); printf("Enter any Integer Valuet"); scanf("%d",&i); x=&i; printf("nx=Address value of in"); printf("nValue of x = %u",x); x++; printf("nAfter Increment in Pointern"); printf("Value of x = %u",x); getch(); } Vinay Arora CSED
  • 12. Program – 4 (output) Vinay Arora CSED
  • 13. Program - 5 #include<stdio.h> #include<conio.h> void main() { int a=10, b=20, *p, *j; clrscr(); p=&a; j=&b; printf("nAddition *p + b = %d", *p + b); printf("nAddition *p + *j = %d", *p + *j); printf("nAddition *(p) + *(j) = %d", *(p) + *(j)); printf("nAddition *(&a) + *(&b) = %d", *(&a) + *(&b)); getch(); } Vinay Arora CSED
  • 14. Program – 5 (output) Vinay Arora CSED
  • 15. Program - 6 #include<stdio.h> #include<conio.h> printf("nj - i = %d",j-i); printf("n*j - *i =%d",*j - *i); void main() { getch(); int arr[]={10,20,30,45,67,56,74}; } int *i,*j; int x; clrscr(); printf("Array Elements are"); for(x=0;x<=6;x++) { printf("n Value at arr[%d] is %d",x,arr[x]); } i=&arr[1]; j=&arr[5]; Vinay Arora CSED
  • 16. Program – 6 (output) Vinay Arora CSED
  • 17. Program - 7 #include<stdio.h> for(i=0;i<=5;i++) #include<conio.h> { printf("nAddress = %u",j); void main() printf("nElement = %d",*j); { j++; int num[]={24,34,12,44,56,17}; } int i,*j; getch(); clrscr(); } printf("Array Elements are"); for(i=0;i<=5;i++) { printf("n Value at arr[%d] is %d",i,num[i]); } j=&num[0]; Vinay Arora CSED
  • 18. Program – 7 (output) Vinay Arora CSED
  • 19. Program – 8 (Diff. notations for accessing Array) #include<stdio.h> getch(); #include<conio.h> } void main() { int num[]={24,34,12}; int i; clrscr(); printf("Array Elements are"); for(i=0;i<=2;i++) { printf("n Value at arr[%d] is %d",i,num[i]); printf("n Value at arr[%d] is %d",i,i[num]); printf("n Value at arr[%d] is %d",i,*(num+i)); printf("n Value at arr[%d] is %d",i,*(i+num)); printf("n"); } Vinay Arora CSED
  • 20. Program – 8 (output) Vinay Arora CSED
  • 21. Program - 9 #include<stdio.h> #include<conio.h> void main() { int s[3][2]={ {10,15}, {20,25}, {30,35} }; int i; clrscr(); for(i=0;i<=2;i++) printf("Address of %dth 1-D array = %un",i,s[i]); getch(); } Vinay Arora CSED
  • 22. Program – 9 (output) Vinay Arora CSED
  • 23. Program – 10 (Conti…) #include<stdio.h> printf("Notation Used is s[i][j])n"); #include<conio.h> for(i=0;i<=2;i++) void main() { { for(j=0;j<=1;j++) int s[3][2]={ { {10,15}, printf("t%d",s[i][j]); {20,25}, } {30,35} printf("n"); }; } int i,j; clrscr(); getch(); printf("Array Elements aren"); } Vinay Arora CSED
  • 24. Program – 10 (Conti…) #include<stdio.h> printf("nAccessing 2-D Arrayn"); #include<conio.h> printf("Notation Used is *(s[i]+j)n"); void main() for(i=0;i<=2;i++) { { int s[3][2]={ for(j=0;j<=1;j++) {10,15}, { {20,25}, printf("t%d",*(s[i]+j)); {30,35} } }; printf("n"); int i,j; } clrscr(); getch(); } Vinay Arora CSED
  • 25. Program – 10 (Conti…) #include<stdio.h> printf("nAccessing 2-D Arrayn"); #include<conio.h> printf("Notation Used is void main() *(*(s+i)+j)n"); { for(i=0;i<=2;i++) int s[3][2]={ { {10,15}, for(j=0;j<=1;j++) {20,25}, { {30,35} printf("t%d",*(*(s+i)+j)); }; } int i,j; printf("n"); clrscr(); } getch(); } Vinay Arora CSED
  • 26. Program – 10 (output) Vinay Arora CSED
  • 27. Program – 11 (Array of Pointer) #include<stdio.h> printf("Address of variable a,b,cn"); #include<conio.h> printf("%un",a); printf("%un",b); void main() printf("%un",c); { int *arr[3]; printf("Value Present in Arrayn"); int i=10, j=20, k=30, m; for(m=0;m<=2;m++) int *a,*b,*c; { printf("n%u",arr[m]); clrscr(); } printf("n"); printf("n"); arr[0] = &i; for(m=0;m<=2;m++) arr[1] = &j; for(m=0;m<=2;m++) { { arr[2] = &k; printf("n%d",*(arr[m])); printf("n%u",&arr[m]); } } a=&i; getch(); b=&j; } c=&k; Vinay Arora CSED
  • 28. Program – 11 (output) Vinay Arora CSED
  • 29. Thnx… Vinay Arora CSED