56. Write a C program to print the address of the character and the character of the string using a pointer.
#include<stdio.h> ( this applies in the given code )
#include
int main(void)
{
char str[50];
char *ch;
printf(“\n Enter String : “);
scanf(“%s”,str);
ch=&str[0];
while(*ch!=’\0′)
{
printf(“\n Position : %u Character : %c”,ch,*ch);
ch++;
}
return 0;
}
OUTPUT
Enter String : sachin
Position : 2853257808 Character : s
Position : 2853257809 Character : a
Position : 2853257810 Character : c
Position : 2853257811 Character : h
Position : 2853257812 Character : i
Position : 2853257813 Character : n