I'm having a bit of a problem to understand pointer with one of my program
Pointer variable hold memory location, int *p; it means it hold the only integer
I'm having a bit of a problem to understand following lines
There are three pointer one integer pointer and two pointer to structure.
Is psv point content of p that is memory location of variable ? but it can be only int type
Is psv point content of ps that is memory location of variable but it can be any type int, char, flot
Code:
#include<stdio.h>
#include<stdlib.h>
struct s{
int *p; // member structure type int
struct s *ps; // member structure type struct
};
int main (){
struct s *psv = malloc(sizeof (struct s)); //structure variable type struct
if (psv == NULL) {
printf ("Malloc failed\n");
}
printf ("Malloc Allocated \n");
psv->p;
psv->ps;
free (psv);
return 0;
}
I'm having a bit of a problem to understand following lines
Code:
psv->p;
psv->ps;
Is psv point content of p that is memory location of variable ? but it can be only int type
Is psv point content of ps that is memory location of variable but it can be any type int, char, flot