Select Page

Global and static pointers

by 11.03.2023C pointers

Global and static pointers are initialized to NULL when the program starts. It is shown in the example below:

int	*globalptr;

void	ft_function()
{
	static int	*staticptr;
	...
}

int	main(void)
{
	...
}

Static and global variables are often place in a data segment that is separate from the data segment used by the stack and heap.

SOURCE:
[1] Understanding and Using C Pointers by Richard Reese (O’Reilly). Copyright 2013 Richard Reese, Ph.D. 978-1-449-34418-4