Pointer
Pointer Declaration for Primitive Data Type
#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
#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;
}
Last updated