Develop a C program to create, initialize and access a pointer for strings

Code

#include <stdio.h>

int main(void) {
// string variable
char str[6] = "Hello";
// pointer variable
char *ptr = str;
// print the string
while(*ptr != '\0') {
printf("%c", *ptr);
// move the ptr pointer to the next memory location
ptr++;
}
return 0;
}

Output

Hello


put smile on your face...