prev up next   top/contents search

comp.lang.c FAQ list · Question 10.5b

Q: What's the difference between

	const MAXSIZE = 100;
and
	#define MAXSIZE 100


A: A preprocessor #define gives you a true compile-time constant. In C, const gives you a run-time object which you're not supposed to try to modify; ``const'' really means ``readonly''. See also the question 11.8. (But in C++, const is closer to #define.)

Additional links: longer explanation


prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North