Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
2 of 3
added 23 characters in body; added 6 characters in body
drahnr
  • 6.9k
  • 5
  • 52
  • 76

You could simply use M_PI from the <math.h> include (there are other constants too).

A direct solution to your question would be:

globals.h:

double g_pi; 

globals.c

g_pi = 3.; 

For all other .c and .h files:

extern double g_pi; 

Also see wikipedia

drahnr
  • 6.9k
  • 5
  • 52
  • 76