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);

}

Output
[a]
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,
 #include<stdio.h>
     #include<conio.h>
        int main()
        {
        char ch='a';
        char*ptr=&ch;
        clrscr();
        printf("%d %c",*ptr,ch);
        getch();
        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, networking, learning, and sharing knowledge.