Summary: How to Declare a Simple Variable
Choose the type you need.
Choose a name for the variable.
Use this format for a declaration statement: type-specifier variable-name;. The type-specifier is formed from one or more of the type keywords. Here are some examples:
int erest; unsigned short cash;
To declare more than one variable of the same type, separate the variable names with commas:
char ch, init, ans;
You can initialize a variable in a declaration statement:
float mass = 6.0E24;
Summary: Storage ClassesKeywords: auto, extern, static, register General Comments: The storage class of a variable determines its scope, its linkage, and its storage duration. Storage class is determined both by where the variable is defined and by its associated ... |
Get C Primer Plus®, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.