-->
Showing posts with label WAP to input a string and to print its address(character's) with its value.. Show all posts
Showing posts with label WAP to input a string and to print its address(character's) with its value.. Show all posts

WAP to input a string and to print its address(character's) with its value.

//progrm to print address and value of a string given by user.
#include <stdio.h>
int main()
{
    char name[30];
    char *p;
    int i=0;
    printf("enter the string\n");
    scanf("%s",name);
    p=name;//assigning base address
    while(*p!='\0')//condition testing
    {
    printf("the address=%d and value=%c\n",p+i,*p);//printing value and address
   *p++;//changing the value
    i++;//changing the value of i
    }
 

    return 0;
}