PPS Practical 57

PPS Practical 57
  • Aim: Write a program to access elements using pointer.
  • Code:
    //For turbo C++ remove below comments
    #include <stdio.h>
    //#include<conio.h>
    void main()
    {
        // clrscr();
        char str[100];
        char *ptr;
        printf("Enter a string: ");
        gets(str);
        ptr = &str[0];
        printf("your Entered string: \n");
        while (*ptr != '\0')
            printf("%c", *ptr++);
        // getch();
    }
  • Output:
    Output of practical 57

Comments