please give a simple program for learning "char*".....thanks

Recommended Answers

All 3 Replies

#include <stdio.h> 

void main(void)
    char ch = 'a';   //defining a character
    char *charpointer = &ch; //assigning char"a" to charpointer

    printf("\n [%c]", *charpointer);


Here charpointer stores the address of "a"
*charpointer means value of variable stored whose address is stored in charpointer

thanks alot

With reference to ur query,
        int main()
        char ch='a';
        printf("%d %c",*ptr,ch);
        return 0;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.