Develop a C program to create, initialize and access a pointer for strings
Code
#include <stdio.h>int main(void) {// string variablechar str[6] = "Hello";// pointer variablechar *ptr = str;// print the stringwhile(*ptr != '\0') {printf("%c", *ptr);// move the ptr pointer to the next memory locationptr++;}return 0;}
Output
Hello
put smile on your face...
0 Comments
Post a Comment