PPS Practical 56

PPS Practical 56
  • Aim: Write a C program to print the address of character and the character of string 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;
        printf("Entered string is: \n");
        while (*ptr != '\0')
            printf("Address=%d \t Value=%c\n", ptr, *ptr++);
        // getch();
    }
  • Output:
    Output of practical 56

Comments