Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

The GNU C Programming Tutorial - Type errors

Node:Type errors, Previous:Typographical errors, Up:Errors



Type errors

C supports a variety of variable types (different kinds of variables for different kinds of data), such as integer for integer numbers, and float for numbers with fractional parts. You can even define your own types, such as total for a sum, or surname for someone's last name. You can also convert a variable of one type into other types. (This is called type coercion.) Consequently, the type of a variable is of great importance to the compiler.

C requires us to list the names and types of all variables that will be used in a program, and provide information about where they are going to be used. This is called declaring variables. If you fail to declare a variable, or use it as if it were a different type from the type it is declared to be, for example, by assigning a non-integer value to an integer variable, you will receive a compile-time error.

See Variables and declarations, for more information on variable declarations. See The form of a C program, for some simple examples of variable declarations.

 
 
  Published under free license. Design by Interspire