C program: i am getting errors when compiling this simple program
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
The tokens 'ox2' and '0x2' are interpreted by the compiler in completely distinct ways. The compiler sees any token beginning with the characters '0x' to be an integer constant value expressed in hexadecimal notation. Variables must have alpha characters as the first character in their name, and the token 'ox2' is interpreted as a variable name, just like the token 'x' that you have already used. Since that variable has not been declared, the compiler doesn't know about the type of the variable, and makes the accordant complaint.