source code to access array elements using pointer

Upload: vigneshramakrishnan

Post on 07-Jul-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/18/2019 Source Code to Access Array Elements Using Pointer

    1/3

    Source Code to Access Array Elements Using Pointer

    #include

    int main(){

      int data[5], i;

      printf("Enter elements ");

      for(i!;i

  • 8/18/2019 Source Code to Access Array Elements Using Pointer

    2/3

    - ro/ram to 01ap Elements 2sin/ -all 34 eference

    #include

    6oid -4cle(int 'a,int '3,int 'c);

    int main(){

      int a,3,c;

      printf("Enter 6alue of a, 3 and c respecti6el4 ");

      scanf("$d$d$d",7a,73,7c);

      printf("8alue 3efore s1appin/&n");

      printf("a!$d&n3!$d&nc!$d&n",a,3,c);

      -4cle(7a,73,7c);

      printf("8alue after s1appin/ num3ers in c4cle&n");

      printf("a!$d&n3!$d&nc!$d&n",a,3,c);

      return ;

    6oid -4cle(int 'a,int '3,int 'c){

      int temp;

      temp!'3;

      '3!'a;

      'a!'c;

      'c!temp;

    Output

    Enter 6alue of a, 3 and c respecti6el4

    *

    +

    8alue 3efore s1appin/

  • 8/18/2019 Source Code to Access Array Elements Using Pointer

    3/3

    a!

    3!*

    c!+

    8alue after s1appin/ num3ers in c4cle

    a!+

    3!

    c!*