> For the complete documentation index, see [llms.txt](https://mun.gitbook.io/c/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mun.gitbook.io/c/c/ch1/declaration-of-derived-data-type/pointer.md).

# Pointer

## Pointer Declaration for Primitive Data Type

```c
#include<stdio.h>
int main(){

    int a;
    int *p = &a;
    
    float b;
    float *q = &a;
    
    double c;
    double *r = &a;
    
    char d;
    char *s = &a;
    
    void *t = NULL;
    
    return 0;
}
```

## Pointer Declaration for Primitive Data Type Using Dynamic Memory Allocation

```c
#include<stdio.h>
int main(){
    
    void *p = malloc(4);
    
    int *q = (int*)malloc(sizeof(int));
    
    float *r = (float*)malloc(sizeof(float));
    
    double *s = (double*)malloc(sizeof(double));
    
    char *t = (char *)malloc(sizeof(char ));
    
    return 0;
}
```
