To declare the user defined string & to display it using pointers

#include<stdio.h>
main()
{
    char str[100],*p,*q,i,j;
    printf("Enter the string\n");
    gets(str);
    p=&str;
    j=strlen(str);
    printf("The entered string is ");
    for(i=0;i<j;i++)
    {
        printf("%c",*(p+i));
    }

}

 

 

OUTPUT:

Enter the string

bloggingsimplified

The entered string is bloggingsimplified

Download the program:

To declare the user defined string & to display it using pointers

Leave a Reply

Your email address will not be published.