text:
Computer Programming

Computer programming is the craft of writing useful, maintainable, and extensible source code which can be interpreted or compiled by a computing system to perform a meaningful task. Programming a computer can be performed in one of numerous languages, ranging from a higher-level language to writing directly in low-level machine code (that is, code that more directly controls the specifics of the computer's hardware) all the way down to writing microcode (which does directly control the electronics in the computer).

Using programming languages and markup languages (such as XHTML and XForms) require some of the same skills, but using markup languages is generally not considered "programming." Nevertheless, many markup languages allow inclusion of scripts, e.g. many HTML documents contain JavaScript. There are exceptions where markup languages do represent programming such as SuperX++ (http://xplusplus.sourceforge.net/) and o:XML (http://www.o-xml.org/)

Computer programming is one part of a much larger discipline known as software engineering, which includes several different aspects of making software including design, construction and quality control. The subject of this book is software construction, that is, programming. Computer programming is also a useful skill (though not always necessary) for people who are interested in computer science. Whereas software engineering is interested specifically in making software, computer science tends to be oriented towards more theoretical or mathematical problems.

Getting started
Many people think they must choose a specific programming language in order to become a programmer, believing that they can only do that language. They ask themselves, "Should I be a C programmer or a Java programmer?" That's completely the wrong question. The right question is "How can I become a good programmer?" Unfortunately the employment market has contributed greatly to misconceptions about computer programming by companies advertising for employees with a specific (therefore limited) computer language skill-set and responses being handled by human resources(HR), without someone with a programming background.

There are a few points one can make about what a good programmer knows about specific computer languages. First - many languages are based on the same fundamental building blocks. Learning a language should be seen more as a way of acquiring those concepts than language or machine specific techniques. Second - good programmers are generally competent in more than one language because it is naturally interesting and useful to find different ways of solving problems. It is not necessary to master many different languages or even more than one—a programmer could excel in one language and have only a vague working idea how to program others. It is useful to know many different methods for solving computer problems, also known as algorithms. An algorithm is a list of well-defined instructions for completing a task, and knowing several languages means having the ability to list the computer instructions in many different ways. Since computer programming languages have so much in common, it is generally easy to learn a new programming language once you have mastered another.

So how do you get started? One reasonable technique would be to just pick a language and run with it. Unfortunately, we cannot suggest what the right computer language might be for all people for all purposes. Ask ten programmers what language you should learn and you will get ten different responses. Given the collaborative nature of this wikibook, you'll probably get as many responses as there are programming language books on the site.

Families of languages
There is a common misconception by people unfamiliar with computer programming that all programming languages are essentially the same. In one sense this is true because all digital electronic computers translate programming languages into strings of ones and zeros called binary, or Machine code.

While mainstream, personal computer languages tend to be derived from a specific tradition and are very similar (hence the popularity of this misconception), some languages fall into different paradigms which provide for a radically different programming experience. Programming in Java is quite different from programming in assembly language, which is quite different from programming in Haskell or Prolog or Forth, etc.

In the American Scientist article The Semicolon Wars, Brian Hayes classifies languages into four categories: imperative, object-oriented, functional, and declarative. Imperative and object-oriented languages tend to be used in the mainstream, whereas functional and declarative languages tend to be used in academic settings. Functional and declarative programming enthusiasts might argue that the paradigms are 20 years ahead of the mainstream and superior in many respects; however, mainstream language advocates would probably counter that such paradigms are hard to learn, or not very practical for their own unpopularity, among other things. We do not make any claims about who is right on this matter, but at the very least, we will suggest that building familiarity with the four major paradigms is an extremely valuable exercise.

 * /Functional programming/
 * /Imperative programming/
 * (see also Procedural programming )
 * Object oriented programming

When it comes to computers, all things are made, and function primarily by, programming. Although programming is an essential part of the functionality of any computer or application, not all programming languages are the same. In fact, they are very different from one another with different uses, functionality, and different levels of complexity. A programming language, in the most basic way, is a set of rules or guidelines that is used to write the computer programs. Even though you are writing the program, you may need a certain type of software or program for the language that you use. There are many different types of programming languages that can be used and each has a different set of rules. Programming has two basic categories. There are low-level and high-level languages, the difference between the two is that low-level languages often use 0s and 1s, and this works because it gives the computer the ability to quickly understand what needs to be done or executed. High level languages are easier to write because they are much closer to the English language and are much more flexible to write with, although there are also different levels of this readability as well and different categories of these languages that can be written. A few examples would be Visual Basic, C++, and Java.

Common concepts
Programming languages tend to have many general concepts in common. One can examine the recurring concepts and how they are expressed in various languages in the following table.

To see a comparison of syntax in various programming languages, see these "Hello World" examples. For a list including various computer languages arranged together by syntax terms and patterns, see Wikipedia's lists of computer syntax patterns.

Programming skills
Computer programming is really just about solving problems. It turns out that a large number of the problems you encounter in the real world are really just special cases of a more general problem. Luckily for you, many of these problems have been studied by computer scientists for a very long time, sometimes leading to provably unbeatable solutions, or sometimes solutions which are "good enough" for every day needs. In short, learning a language gives you skills, but learning data structures and algorithms shows you how to use these skills wisely.

Data Structures and algorithms

 * Data Structures
 * Algorithms
 * Advanced Data Structures and Algorithms

Language-related skills

 * /Agent Oriented Programming/
 * /Ars based programming/
 * /Aspect oriented programming/
 * /Component based software development/
 * Concurrent programming
 * /Constraint-based programming/
 * /Design by Contract/
 * /Distributed programming/
 * Embedded programming
 * /Event driven programming/
 * /Generic programming/
 * /Post object programming/
 * /Relational programming/
 * /Symbolic programming/
 * /System Programming/

Programming for applications

 * /Application development/
 * Artificial Intelligence
 * Databases
 * /Drivers/
 * /Games/
 * Internet & Networking
 * /Multimedia/
 * /Operating system creation/
 * /Physics/

Programming for platforms

 * /OS Programming/
 * DOS
 * Linux
 * MacOS
 * Windows
 * IBM Midrange Systems
 * IBM Main Frame Systems
 * AROS

Functionalities

 * /Min-Max Normalisation/

General trends

 * /Procedural programming/ vs /Declarative programming/
 * /Structured programming/ (as opposed to unstructured programming)

Specific languages
The following languages deserve special mention, being significant languages in the development of structured programming languages and object-oriented programming. They are worth understanding for the concepts they introduced.

 * ALGOL : was the first structured programming language and as such is the basis for all modern imperative languages. It was built around the notion of a block, delimited by BEGIN and END containing declarations and statements. ALGOL is a recursive general-purpose language, including recursive calls at a time when this was thought too difficult in languages like FORTRAN and COBOL. ALGOL is a stack language, so as blocks are entered, the declared variables are pushed on the stack and when a block exits, the stack is reduced. A block without declarations is not actually a block, but a compound statement, causing no stack building overhead. ALGOL was first developed as ALGOL 58, based on the formal BNF (Backus-Naur Form) language design notation. ALGOL-60 was a revision and this formed the basis of many other languages such as ALGOL-68, ALGOL-W, Pascal, Modula-2, Oberon, C, C++, Java, Simula, Ada, and Eiffel. ALGOL-60 was the first language used for systems programming in the Burroughs B5000 stack machines operating system in the early 1960s (when all else was programmed in assembler and where ALGOL is still used in 2006 Current ALGOL manual ). Learning ALGOL will teach you the basis of block-structured languages and structured programming concepts.

 * Simula : was the first object-oriented language developed in 1967 using ALGOL-60 as a basis (much as C++ used C). It was originally conceived as a simulation language (hence the name) to model real world systems. As ALGOL had been a block-structured language with blocks entered on the stack as they were called and deleted from the stack when exited, Simula liberated programs from this restriction. Thus a block could be entered but when the code exited, the block persisted on the heap, rather than on the stack – thus the object was born. However, unlike records and structures (structs) of other languages, procedures were associated with this saved block so a programmer could define an entire algebra to manipulate entities. Thus variables declared as part of the outer block (class) persisted beyond the original invocation of the block code (which would now be considered a constructor or creation routine). Local variables and arguments to the procedures in the class would be pushed on the stack when called and popped when exited, but would manipulate the object’s persistent state. Class facilities could be abstracted by use of inheritance. Simula also included a sophisticated concurrency paradigm. Learning Simula will teach you object-oriented and simulation concepts along with concurrency concepts and the use of coroutines and cooperating processes.

 * Smalltalk : was developed by Adele Goldberg, Alan Kay (the real inventor of Windows) and others at Xerox PARC. It is an object-oriented language with a natural language syntax. It is a typeless language and thus very flexible and dynamic, resulting in quick turn around of code, but can result in exceptions at run time that would have been caught at compile time by a typed language. Its concepts were the basis of Objective-C. Learning Smalltalk will teach you object-oriented programming in a typeless language with a very different syntax.

 * C++ : C++ (pronounced "see plus plus") is a general-purpose, object-oriented, statically typed, free-form, multi-paradigm programming language supporting procedural programming, data abstraction, and generic programming. During the 1990s, C++ became one of the most popular computer programming languages.
 * Bjarne Stroustrup from Bell Labs was the designer and original implementer of C++ (originally named "C with Classes") during the 1980s as an enhancement to the C programming language. Enhancements started with the addition of classes, followed by, among many features, virtual functions, operator overloading, multiple inheritance, templates, and exception handling, these and other features are covered in detail in several Wikibooks on the subject.
 * The C++ programming language standard was ratified in 1998 as ISO/IEC 14882:1998, the current version of which is the 2003 version, ISO/IEC 14882:2003.
 * The 1998 C++ Standard consists of two parts: the Core Language and the Standard Library; the latter includes the Standard Template Library and C's Standard Library. Many C++ libraries exist which are not part of the Standard, such as Boost. Also, non-Standard libraries written in C can generally be used by C++ programs.
 * Features introduced in C++ include declarations as statements, function-like casts, new/delete, bool, reference types, const, inline functions, default arguments, function overloading, namespaces, classes (including all class-related features such as inheritance, member functions, virtual functions, abstract classes, and constructors), operator overloading, templates, the :: operator, exception handling, run-time type identification, and more type checking in several cases. Comments starting with two slashes ("//") were originally part of BCPL, and was reintroduced in C++. Several features of C++ were later adopted by C, including const, <tt>inline</tt>, declarations in <tt>for</tt> loops, and C++-style comments (using the <tt>//</tt> symbol).

 * Visual Basic : Visual Basic is one of the worlds most commonly used programming languages. This is because of its simplicity and ease of use. The name BASIC stands for Beginners All-Purpose Symbolic Instruction Code and was developed at Dartmouth College in the USA for students. Visual Basic extends the functionality of the language so that creating windows, title-bars, input boxes, labels, message boxes and buttons is as simple as dragging the item you wish to code from a toolbar onto a form which is essentially a blank Window. One of the most basic functions of VB is the message box command. If I wanted to make a message box appear with a chosen message, all i would have to type would be: msgbox "hello world"

 * Java : Java 2 Micro Edition

Editors
An editor is simply a text program like Notepad. It is said that a programmer's best friend is the editor. A good editor is lightweight, has only essential tools and should support syntax highlighting for your language.

Examples of good editors for which we have teaching books are (alphabetically) :

 * Emacs : An extensible, customizable, free/libre text editor — and more. At its core is an interpreter for Emacs Lisp, a dialect of the Lisp programming language with extensions to support text editing.
 * Vim : An abbreviation of Vi Improved, this editor is modelled on the classic Unix editor vi. However, Vim is a much more modern editor with an optional graphical interface and quite a few features vi doesn't have, making it the editor of choice for someone experienced with vi.

For more text editors, see Wikipedia's text editor category.

Tools

 * gcc, a free compiler collection (Ada, C, C++, Fortran, Java, Objective-C, Objective-C++).
 * make, the most popular build scripting language.
 * Apache Ant, an XML-based build scripting language similar to Make.
 * Some people use an integrated development environment (IDE) while programming.
 * Eclipse, a software framework used as an IDE for Java, C++, PHP, Python, and a few other languages.
 * Comparison of integrated development environments lists an IDE for every popular programming language.
 * , an IDE (compiler included). Supporting C, C++, C++/CLI (via ), VB.NET (via Visual Basic .NET), C# (via Visual C#), and F# (as of Visual Studio 2010[9]). Support for other languages such as Python, Ruby, Node.js, and M among others is available via language services installed separately. It also supports XML/XSLT.
 * Some people use a version control system. Such systems make it much easier to answer "Last week's version worked. This week's version doesn't. What changed?".
 * Subversion
 * Source Control Management With Git

Popular libraries
Unix native
 * Cocoa/OPENSTEP framework
 * FreeType2
 * IJG JPEG Library
 * Mesa3D
 * GTK+
 * LibPng

Windows "native"
 * DirectX
 * Managed DirectX

Cross platform
 * Allegro
 * wxWidgets
 * OpenGL
 * Qt - Popular object oriented C++ GUI framework. KDE is based on it. Bindings for various languages are available.
 * XUL XML based GUI.
 * Simple DirectMedia Layer (SDL)

Format Reference

 * Poor Text Format

Misc

 * /Coding Style/
 * Debugging
 * C Networking in UNIX
 * An introduction to computer programming
 * A beginners' programming forum
 * Hello World Example Hello World Program Examples in Many Programming Language

title: Computer Programming


text:
C Programming/Variables

Like most programming languages, C uses and processes variables. In C, variables are human-readable names for the computer's memory addresses used by a running program. Variables make it easier to store, read and change the data within the computer's memory by allowing you to associate easy-to-remember labels for the memory addresses that store your program's data. The memory addresses associated with variables aren't determined until after the program is compiled and running on the computer.

At first, it's easiest to imagine variables as placeholders for values, much like in mathematics. You can think of a variable as being equivalent to its assigned value. So, if you have a variable i that is initialized (set equal) to 4, then it follows that i + 1 will equal 5. However, a skilled C programmer is more mindful of the invisible layer of abstraction going on just under the hood: that a variable is a stand-in for the memory address where the data can be found, not the data itself. You will gain more clarity on this point when you learn about pointers.

Since C is a relatively low-level programming language, before a C program can utilize memory to store a variable it must claim the memory needed to store the values for a variable. This is done by declaring variables. Declaring variables is the way in which a C program shows the number of variables it needs, what they are going to be named, and how much memory they will need.

Within the C programming language, when managing and working with variables, it is important to know the type of variables and the size of these types. A type’s size is the amount of computer memory required to store one value of this type. Since C is a fairly low-level programming language, the size of types can be specific to the hardware and compiler used – that is, how the language is made to work on one type of machine can be different from how it is made to work on another.

All variables in C are typed. That is, every variable declared must be assigned as a certain type of variable.

Declaring, Initializing, and Assigning Variables
Here is an example of declaring an integer, which we've called some_number. (Note the semicolon at the end of the line; that is how your compiler separates one program statement from another.)

This statement tells the compiler to create a variable called  and associate it with a memory location on the computer. We also tell the compiler the type of data that will be stored at that address, in this case an integer. Note that in C we must specify the type of data that a variable will store. This lets the compiler know how much total memory to set aside for the data (on most modern machines an  is 4 bytes in length). We'll look at other data types in the next section.

Multiple variables can be declared with one statement, like this:

In early versions of C, variables had to be declared at the beginning of a block. In C99 it is allowed to mix declarations and statements arbitrarily – but doing so is not usual, because it is rarely necessary, some compilers still don’t support C99 (portability), and it may, because it is uncommon yet, irritate fellow programmers (maintainability).

After declaring variables, you can assign a value to a variable later on using a statement like this: The assignment of a value to a variable is called initialization. The above statement directs the compiler to insert an integer representation of the number "3" into the memory address associated with. We can save a bit of typing by declaring and assigning data to a memory address at the same time:

You can also assign variables to the value of other variable, like so: Or assign multiple variables the same value with one statement: This is because the assignment x = y returns the value of the assignment, y. For example, some_number = 4 returns 4. That said, x = y = z  is really a shorthand for x = (y = z).

Naming Variables
Variable names in C are made up of letters (upper and lower case) and digits. The underscore character ("_") is also permitted. Names must not begin with a digit. Unlike some languages (such as Perl and some BASIC dialects), C does not use any special prefix characters on variable names.

Some examples of valid (but not very descriptive) C variable names: Some examples of invalid C variable names: As the last example suggests, certain words are reserved as keywords in the language, and these cannot be used as variable names.

It is not allowed to use the same name for multiple variables in the same scope. When working with other developers, you should therefore take steps to avoid using the same name for global variables or function names. Some large projects adhere to naming guidelines to avoid duplicate names and for consistency.

In addition there are certain sets of names that, while not language keywords, are reserved for one reason or another. For example, a C compiler might use certain names "behind the scenes", and this might cause problems for a program that attempts to use them. Also, some names are reserved for possible future use in the C standard library. The rules for determining exactly what names are reserved (and in what contexts they are reserved) are too complicated to describe here, and as a beginner you don't need to worry about them much anyway. For now, just avoid using names that begin with an underscore character.

The naming rules for C variables also apply to naming other language constructs such as function names, struct tags, and macros, all of which will be covered later.

Literals
Anytime within a program in which you specify a value explicitly instead of referring to a variable or some other form of data, that value is referred to as a literal. In the initialization example above, 3 is a literal. Literals can either take a form defined by their type (more on that soon), or one can use hexadecimal (hex) notation to directly insert data into a variable regardless of its type. Hex numbers are always preceded with 0x. For now, though, you probably shouldn't be too concerned with hex.

The Four Basic Data Types
In Standard C there are four basic data types. They are,  ,  , and.

The type
The int type stores integers in the form of "whole numbers". An integer is typically the size of one machine word, which on most modern home PCs is 32 bits (4 octets). Examples of literals are whole numbers (integers) such as 1, 2, 3, 10, 100... When int is 32 bits (4 octets), it can store any whole number (integer) between -2147483648 and 2147483647. A 32 bit word (number) has the possibility of representing any one number out of 4294967296 possibilities (2 to the power of 32).

If you want to declare a new int variable, use the <tt>int</tt> keyword. For example:

In this declaration we declare 3 variables, numberOfStudents, i and j, j here is assigned the literal 5.

The type
The  type is capable of holding any member of the execution character set. It stores the same kind of data as an  (i.e. integers), but typically has a size of one byte. The size of a byte is specified by the macro  which specifies the number of bits in a char (byte). In standard C it never can be less than 8 bits. A variable of type  is most often used to store character data, hence its name. Most implementations use the ASCII character set as the execution character set, but it's best not to know or care about that unless the actual values are important.

Examples of character literals are 'a', 'b', '1', etc., as well as some special characters such as ' ' (the null character) and ' ' (newline, recall "Hello, World"). Note that the  value must be enclosed within single quotations.

When we initialize a character variable, we can do it two ways. One is preferred, the other way is bad programming practice.

The first way is to write:

This is good programming practice in that it allows a person reading your code to understand that letter1 is being initialized with the letter 'a' to start off with.

The second way, which should not be used when you are coding letter characters, is to write:

This is considered by some to be extremely bad practice, if we are using it to store a character, not a small number, in that if someone reads your code, most readers are forced to look up what character corresponds with the number 97 in the encoding scheme. In the end,  and   store both the same thing – the letter 'a', but the first method is clearer, easier to debug, and much more straightforward.

One important thing to mention is that characters for numerals are represented differently from their corresponding number, i.e. '1' is not equal to 1. In short, any single entry that is enclosed within 'single quotes'.

There is one more kind of literal that needs to be explained in connection with chars: the string literal. A string is a series of characters, usually intended to be displayed. They are surrounded by double quotations (" ", not ' '). An example of a string literal is the "Hello, World!\n" in the "Hello, World" example.

The string literal is assigned to a character array, arrays are described later. Example:

The type
is short for floating point. It stores inexact representations of real numbers, both integer and non-integer values. It can be used with numbers that are much greater than the greatest possible. literals must be suffixed with F or f. Examples are: 3.1415926f, 4.0f, 6.022e+23f.

It is important to note that floating-point numbers are inexact. Some numbers like 0.1f cannot be represented exactly as s but will have a small error. Very large and very small numbers will have less precision and arithmetic operations are sometimes not associative or distributive because of a lack of precision. Nonetheless, floating-point numbers are most commonly used for approximating real numbers and operations on them are efficient on modern microprocessors. Floating-point arithmetic is explained in more detail on Wikipedia.

variables can be declared using the <tt>float</tt> keyword. A  is only one machine word in size. Therefore, it is used when less precision than a double provides is required.

The type
The <tt>double</tt> and <tt>float</tt> types are very similar. The <tt>float</tt> type allows you to store single-precision floating point numbers, while the <tt>double</tt> keyword allows you to store double-precision floating point numbers – real numbers, in other words. Its size is typically two machine words, or 8 bytes on most machines. Examples of <tt>double</tt> literals are 3.1415926535897932, 4.0, 6.022e+23 (scientific notation). If you use 4 instead of 4.0, the 4 will be interpreted as an <tt>int</tt>.

The distinction between floats and doubles was made because of the differing sizes of the two types. When C was first used, space was at a minimum and so the judicious use of a float instead of a double saved some memory. Nowadays, with memory more freely available, you rarely need to conserve memory like this – it may be better to use doubles consistently. Indeed, some C implementations use doubles instead of floats when you declare a float variable.

If you want to use a double variable, use the <tt>double</tt> keyword.

<tt>sizeof</tt>
If you have any doubts as to the amount of memory actually used by any variable (and this goes for types we'll discuss later, also), you can use the <tt>sizeof</tt> operator to find out for sure. (For completeness, it is important to mention that <tt>sizeof</tt> is a unary operator, not a function.) Its syntax is:

The two expressions above return the size of the object and type specified, in bytes. The return type is <tt>size_t</tt> (defined in the header <tt><stddef.h></tt>) which is an unsigned value. Here's an example usage:

<tt>size</tt> will be set to 4, assuming <tt>CHAR_BIT</tt> is defined as 8, and an integer is 32 bits wide. The value of <tt>sizeof</tt>'s result is the number of bytes.

Note that when <tt>sizeof</tt> is applied to a <tt>char</tt>, the result is 1; that is:

always returns 1.

Data type modifiers
One can alter the data storage of any data type by preceding it with certain modifiers.

<tt>long</tt> and <tt>short</tt> are modifiers that make it possible for a data type to use either more or less memory. The <tt>int</tt> keyword need not follow the <tt>short</tt> and <tt>long</tt> keywords. This is most commonly the case. A <tt>short</tt> can be used where the values fall within a lesser range than that of an <tt>int</tt>, typically -32768 to 32767. A <tt>long</tt> can be used to contain an extended range of values. It is not guaranteed that a <tt>short</tt> uses less memory than an <tt>int</tt>, nor is it guaranteed that a <tt>long</tt> takes up more memory than an <tt>int</tt>. It is only guaranteed that sizeof(short) <= sizeof(int) <= sizeof(long). Typically a <tt>short</tt> is 2 bytes, an <tt>int</tt> is 4 bytes, and a <tt>long</tt> either 4 or 8 bytes. Modern C compilers also provide <tt>long long</tt> which is typically an 8 byte integer.

In all of the types described above, one bit is used to indicate the sign (positive or negative) of a value. If you decide that a variable will never hold a negative value, you may use the <tt>unsigned</tt> modifier to use that one bit for storing other data, effectively doubling the range of values while mandating that those values be positive. The <tt>unsigned</tt> specifier also may be used without a trailing <tt>int</tt>, in which case the size defaults to that of an <tt>int</tt>. There is also a <tt>signed</tt> modifier which is the opposite, but it is not necessary, except for certain uses of <tt>char</tt>, and seldom used since all types (except <tt>char</tt>) are signed by default.

The <tt>long</tt> modifier can also be used with <tt>double</tt> to create a <tt>long double</tt> type. This floating-point type may (but is not required to) have greater precision than the <tt>double</tt> type.

To use a modifier, just declare a variable with the data type and relevant modifiers:

<tt>const</tt> qualifier
When the <tt>const</tt> qualifier is used, the declared variable must be initialized at declaration. It is then not allowed to be changed.

While the idea of a variable that never changes may not seem useful, there are good reasons to use <tt>const</tt>. For one thing, many compilers can perform some small optimizations on data when it knows that data will never change. For example, if you need the value of π in your calculations, you can declare a const variable of <tt>pi</tt>, so a program or another function written by someone else cannot change the value of <tt>pi</tt>.

Note that a Standard conforming compiler must issue a warning if an attempt is made to change a <tt>const</tt> variable - but after doing so the compiler is free to ignore the <tt>const</tt> qualifier.

Magic numbers
When you write C programs, you may be tempted to write code that will depend on certain numbers. For example, you may be writing a program for a grocery store. This complex program has thousands upon thousands of lines of code. The programmer decides to represent the cost of a can of corn, currently 99 cents, as a literal throughout the code. Now, assume the cost of a can of corn changes to 89 cents. The programmer must now go in and manually change each entry of 99 cents to 89. While this is not that big a problem, considering the "global find-replace" function of many text editors, consider another problem: the cost of a can of green beans is also initially 99 cents. To reliably change the price, you have to look at every occurrence of the number 99.

C possesses certain functionality to avoid this. This functionality is approximately equivalent, though one method can be useful in one circumstance, over another.

Using the <tt>const</tt> keyword
The <tt>const</tt> keyword helps eradicate magic numbers. By declaring a variable <tt>const corn</tt> at the beginning of a block, a programmer can simply change that const and not have to worry about setting the value elsewhere.

There is also another method for avoiding magic numbers. It is much more flexible than <tt>const</tt>, and also much more problematic in many ways. It also involves the preprocessor, as opposed to the compiler. Behold...

<tt>#define</tt>
When you write programs, you can create what is known as a macro, so when the computer is reading your code, it will replace all instances of a word with the specified expression.

Here's an example. If you write when you want to, for example, print the price of corn, you use the word  instead of the number 0.99 – the preprocessor will replace all instances of   with 0.99, which the compiler will interpret as the literal   0.99. The preprocessor performs substitution, that is,  is replaced by 0.99 so this means there is no need for a semicolon.

It is important to note that  has basically the same functionality as the "find-and-replace" function in a lot of text editors/word processors.

For some purposes,  can be harmfully used, and it is usually preferable to use   if   is unnecessary. It is possible, for instance, to, say, a macro   as the number 3, but if you try to print the macro, thinking that   represents a string that you can show on the screen, the program will have an error. also has no regard for type. It disregards the structure of your program, replacing the text everywhere (in effect, disregarding scope), which could be advantageous in some circumstances, but can be the source of problematic bugs.

You will see further instances of the  directive later in the text. It is good convention to write d words in all capitals, so a programmer will know that this is not a variable that you have declared but a  d macro. It is not necessary to end a preprocessor directive such as  with a semicolon; in fact, some compilers may warn you about unnecessary tokens in your code if you do.

Scope
In the Basic Concepts section, the concept of scope was introduced. It is important to revisit the distinction between local types and global types, and how to declare variables of each. To declare a local variable, you place the declaration at the beginning (i.e. before any non-declarative statements) of the block to which the variable is deemed to be local. To declare a global variable, declare the variable outside of any block. If a variable is global, it can be read, and written, from anywhere in your program.

Global variables are not considered good programming practice, and should be avoided whenever possible. They inhibit code readability, create naming conflicts, waste memory, and can create difficult-to-trace bugs. Excessive usage of globals is usually a sign of laziness or poor design. However, if there is a situation where local variables may create more obtuse and unreadable code, there's no shame in using globals.

Other Modifiers
Included here, for completeness, are more of the modifiers that standard C provides. For the beginning programmer, static and extern may be useful. volatile is more of interest to advanced programmers. register and auto are largely deprecated and are generally not of interest to either beginning or advanced programmers.

static
<tt>static</tt> is sometimes a useful keyword. It is a common misbelief that the only purpose is to make a variable stay in memory.

When you declare a function or global variable as static, you cannot access the function or variable through the extern (see below) keyword from other files in your project. This is called static linkage.

When you declare a local variable as static, it is created just like any other variable. However, when the variable goes out of scope (i.e. the block it was local to is finished) the variable stays in memory, retaining its value. The variable stays in memory until the program ends. While this behaviour resembles that of global variables, static variables still obey scope rules and therefore cannot be accessed outside of their scope. This is called static storage duration.

Variables declared static are initialized to zero (or for pointers, NULL ) by default. They can be initialized explicitly on declaration to any constant value. The initialization is made just once, at compile time.

You can use static in (at least) two different ways. Consider this code, and imagine it is in a file called jfile.c:

The  variable is accessible by both up and down and retains its value. The  variables also retain their value, but they are two different variables, one in each of their scopes. Static variables are a good way to implement encapsulation, a term from the object-oriented way of thinking that effectively means not allowing changes to be made to a variable except through function calls.

Running the program above will produce the following output:

Features of  variables : 1. Keyword used       - static 2. Storage            - Memory 3. Default value      - Zero 4. Scope              - Local to the block in which it is declared 5. Lifetime           - Value persists between different function calls 6. Keyword optionality - Mandatory to use the keyword

extern
<tt>extern</tt> is used when a file needs to access a variable in another file that it may not have <tt>#include</tt>d directly. Therefore, extern does not allocate memory for the new variable, it just provides the compiler with sufficient information to access a variable declared in another file.

Features of  variable : 1. Keyword used       - extern 2. Storage            - Memory 3. Default value      - Zero 4. Scope              - Global (all over the program) 5. Lifetime           - Value persists till the program's execution comes to an end 6. Keyword optionality - Optional if declared outside all the functions

volatile
<tt>volatile</tt> is a special type of modifier which informs the compiler that the value of the variable may be changed by external entities other than the program itself. This is necessary for certain programs compiled with optimizations – if a variable were not defined <tt>volatile</tt> then the compiler may assume that certain operations involving the variable are safe to optimize away when in fact they aren't. volatile is particularly relevant when working with embedded systems (where a program may not have complete control of a variable) and multi-threaded applications.

auto
<tt>auto</tt> is a modifier which specifies an "automatic" variable that is automatically created when in scope and destroyed when out of scope. If you think this sounds like pretty much what you've been doing all along when you declare a variable, you're right: all declared items within a block are implicitly "automatic". For this reason, the auto keyword is more like the answer to a trivia question than a useful modifier, and there are lots of very competent programmers that are unaware of its existence.

Features of  variables : 1. Keyword used       - auto 2. Storage            - Memory 3. Default value      - Garbage value (random value) 4. Scope              - Local to the block in which it is defined 5. Lifetime           - Value persists while the control remains within the block 6. Keyword optionality - Optional

register
<tt>register</tt> is a hint to the compiler to attempt to optimize the storage of the given variable by storing it in a register of the computer's CPU when the program is run. Most optimizing compilers do this anyway, so use of this keyword is often unnecessary. In fact, ANSI C states that a compiler can ignore this keyword if it so desires – and many do. Microsoft Visual C++ is an example of an implementation that completely ignores the register keyword.

Features of  variables : 1. Keyword used       - register 2. Storage            - CPU registers (values can be retrieved faster than from memory) 3. Default value      - Garbage value 4. Scope              - Local to the block in which it is defined 5. Lifetime           - Value persists while the control remains within the block 6. Keyword optionality - Mandatory to use the keyword

Concepts

 * Variables
 * Types
 * Data Structures
 * Arrays

In this section

 * C variables
 * C arrays

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

title: C Programming/Variables


text:
Computer Programming/Variables

An assignment statements in wikibook pseudocode is written as.

let X := 10

But this is not needed in wikibook pseudocode.

title: Computer Programming/Variables


text:
Wikibooks:Designated agent

Note: Additionally, this page must remain protected for legal reasons.

The designated agent to receive notification of claimed infringement of copyright for Wikibooks may be found at Designated agent

See Online Copyright Infringement Liability Limitation Act, designated agent, designated agent

External link

 * Interim Designation (pdf format)

title: Wikibooks:Designated agent


text:
Wikibooks talk:Protected page

Initial text adapted from en:Wikipedia:Protected page. --mav

Ido wikibooks
A request has been made for one on the discussion page of the main page. io:user:mithridates

Proposed?
Why is this a proposed policy, and not enforced? at the very least, it should be an official guideline, but i think it would do better as an enforced policy. If we need to, i will start the voting myself. -- 21:51, 28 November 2005 (UTC)

Semi-protection
Should we implement semi-protection? At this point, semi-protection would make sense on Wikibooks for major spam targets like Main Page. Guanaco 17:00, 25 December 2005 (UTC)

Semi-protection policy / Move to Reject, merge to Wikibooks:Protected page--Panic 21:56, 20 October 2006 (UTC)

Categories
I propose to clean up the policy page proper (i.e. Protected page) by moving the list of pages to a category. The list of pages itself is not policy, but instead is the result of the policy. As such, the category and a link to there from here should be created. Cheers, Iamunknown 17:19, 12 December 2006 (UTC)

Unstable version
Changes have been made to the unstable version. I'm interested in people's thoughts on it. Also feel free to make changes. (Protected page/Unstable). – Adrignola talk 02:33, 8 December 2010 (UTC)

 * It is missing any process for changing the status of the pages. My view is that 7 days protections shouldn't open for contest and the issue should be solely addressable/reversed by the acting admin, the logic is that there should be already a good enough reason for the action and the time required to come to a clear discussion would have to exceed the 7 days to be recognized. Stating this on the text can reduce those requests. Longer protections should be open for validation (that is) if not originating in a community decision (that must be at least be made visible to the editors of the project (root) of that page) the process will be focused in establishing a consensus to the removal but to the continued protection of the page..
 * There is also a need to establish what constitutes in the content disputes the current version of the page (the page version that the protection will make static). Current version is extremely ambiguous, it depends on how the dispute has been running, most users resort to reversions or other engage in continues changes that promote the content they defend. One example of this type discussions that promote this type of alterations is for instance on the final approval of policies/guidelines drafts, a solution that has been taken is to fix (much like a protection) the proposed text. My view is that the same should be done in any other type of content dispute the version previous to the start of the dispute should be the one to be protected, this is easy to determine by the edits history logs... --Panic (talk) 03:35, 8 December 2010 (UTC)

Pending changes?
I thought there was pending changes. I noticed it in Cookbook:Christmas ham. Qwertyxp2000 (discuss • contribs) 00:44, 22 December 2015 (UTC)

 * Pending changes is not a page protection per se, it is only active on Wikibooks for protection of the readers and it is used in general as a page review tool. Note that it is also an automated process, no administrative action is required (to enable, disable or make a change) and even if possible it is rarely used, most of those few instance have occurred only on Wikijunior. --Panic (discuss • contribs) 01:42, 22 December 2015 (UTC)

title: Wikibooks talk:Protected page


text:
MediaWiki:Recentchangestext

af:Special:RecentChanges ang:Special:RecentChanges ar:Special:RecentChanges az:Special:RecentChanges be:Special:RecentChanges bg:Special:RecentChanges bn:Special:RecentChanges bs:Special:RecentChanges ca:Special:RecentChanges cs:Special:RecentChanges cv:Special:RecentChanges cy:Special:RecentChanges da:Special:RecentChanges de:Special:RecentChanges el:Special:RecentChanges eo:Special:RecentChanges es:Special:RecentChanges et:Special:RecentChanges eu:Special:RecentChanges fa:Special:RecentChanges fi:Special:RecentChanges fr:Special:RecentChanges fy:Special:RecentChanges gl:Special:RecentChanges he:Special:RecentChanges hi:Special:RecentChanges hr:Special:RecentChanges hu:Special:RecentChanges hy:Special:RecentChanges ia:Special:RecentChanges id:Special:RecentChanges ie:Special:RecentChanges is:Special:RecentChanges it:Special:RecentChanges ja:Special:RecentChanges ka:Special:RecentChanges kk:Special:RecentChanges km:Special:RecentChanges ko:Special:RecentChanges ku:Special:RecentChanges ky:Special:RecentChanges la:Special:RecentChanges li:Special:RecentChanges lt:Special:RecentChanges mg:Special:RecentChanges mk:Special:RecentChanges ml:Special:RecentChanges mr:Special:RecentChanges ms:Special:RecentChanges ne:Special:RecentChanges nl:Special:RecentChanges no:Special:RecentChanges oc:Special:RecentChanges pa:Special:RecentChanges pl:Special:RecentChanges pt:Special:RecentChanges ro:Special:RecentChanges ru:Special:RecentChanges sa:Special:RecentChanges si:Special:RecentChanges sk:Special:RecentChanges sl:Special:RecentChanges sq:Special:RecentChanges sr:Special:RecentChanges su:Special:RecentChanges sv:Special:RecentChanges ta:Special:RecentChanges te:Special:RecentChanges tg:Special:RecentChanges th:Special:RecentChanges tl:Special:RecentChanges tr:Special:RecentChanges tt:Special:RecentChanges uk:Special:RecentChanges ur:Special:RecentChanges uz:Special:RecentChanges vi:Special:RecentChanges vo:Special:RecentChanges zh-min-nan:Special:RecentChanges zh:Special:RecentChanges

title: MediaWiki:Recentchangestext


text:
User talk:Brooke Vibber

''' I rarely check this page! Leave me a message on m:User:Brion VIBBER/Todo list rather than here if you ever want to see anything come of your request.'''

-

Brion - you da man! --mav 07:28, 11 Aug 2003 (UTC)

 * Woop! --b

Thanks Brion! :) Dysprosia 10:08, 29 Sep 2003 (UTC)

Brion, can you fix the login problem on Wikibooks, please? Thanks a lot Robbyjo --65.71.169.48 21:52, 22 Nov 2003 (UTC)

test

Wikimania: paper or presentation?
Hi Brion! Are you going to write an additional paper or can we move Wikimania05/Paper-BV1 to Wikimania05/Presentation-BV1 for a presentation only? -- JakobVoss 08:11, 17 July 2005 (UTC)

 * I do plan to have some written material, which I will try to get finished up during Apachecon. --Brion VIBBER 10:50, 19 July 2005 (UTC)

De-adminship
Hello, As all administrators at the English Wikibooks, you are subject to de-adminship if you are inactive for over 1 year, which is currently the case. The request will be made at Meta one month from today. If you would like to object to the de-adminship, please do so at http://en.wikibooks.org/wiki/Wikibooks:Requests_for_permissions#Removal_of_access

Thanks for your time of service as an administrator at English Wikibooks.

– Mike.lifeguard  | talk 00:36, 5 April 2008 (UTC)

 * No worries, I can get it back when I need it! ;) --Brion VIBBER (talk) 23:49, 23 October 2008 (UTC)

title: User talk:Brooke Vibber


text:
User:Brooke Vibber

I'm one of the Wikimedia coding slaves. I don't hang out on Wikibooks much, so if you need to get ahold of me to fix something, please drop a note on my todo list on Meta-Wikipedia. --Brion VIBBER 07:31, 11 Aug 2003 (UTC)

testing:

"I would like to request that the character t and s with a dot underneath are made available in wikiformating as well as the characters a, e, i and u with a line above: ş, ţ and ā, ē, ī and ū They do not show in Wikibooks!"

ṢṣṭṬ

Hello Brion VIBBER,

The characters ş, ţ, ā, ē, ī and ū are not fine as they do only appear as squares in eg. my little oldbabylonian grammar Jakob Flygare 11:50, 17 Jun 2005 (UTC)

title: User:Brooke Vibber


text:
English in Use

Welcome
Welcome to English in Use, a book about the actual use of the English language. It features sections about types of grammar, punctuation and formality. This wikibook is intended for use by native speakers of English or advanced learners of English as a second/foreign language.

If you wish to learn English, then you should use one of the English books for students learning English as a second/foreign language. For new learners of English, try English for beginners book. If you have some experience of English but need to refresh your knowledge, try the English for B2 Students Wikibook. If you're preparing for the Cambridge FCE exam (Cambridge English: First), then head to the Cambridge English: First module. Those interested in English for business contexts should try the Business English Wikibook.

Contents

 * 1) /About/
 * 2) /Introduction/

 * 1) Words:
 * 2) /Articles/
 * 3) /Nouns/
 * 4) /Pronouns/
 * 5) /Verbs/
 * 6) /Adjectives/
 * 7) /Adverbs/
 * 8) /Prepositions, Conjunctions, and Interjections/
 * 9) /Verbals/

 * 1) Sentences:
 * 2) /Sentences Overview/
 * 3) /Basic Components/
 * 4) /Phrases/
 * 5) /Clauses/
 * 6) /Fragments and Run-on Sentences/

 * 1) Usage:
 * 2) /Adjective and Adverb Usage/
 * 3) /Pronoun Usage/
 * 4) /Subject-verb Agreement/
 * 5) /Verb Usage/

 * 1) Punctuation:
 * 2) /Punctuation/ - to be merged
 * 3) /End Marks/
 * 4) /Commas/
 * 5) /Apostrophes/
 * 6) /Quotations/
 * 7) /Other Common Punctuation Marks/
 * 8) /Less Common Typographical Marks/

 * 1) Other key topics:
 * 2) /Time and Date/
 * 3) /Capitalization/
 * 4) /Spelling/
 * 5) /Figures of Syntax/
 * 6) /Syntax/
 * 7) /Orthography/ - to be merged

 * 1) Appendices:
 * 2) /Conversation Pieces/
 * 3) /Glossary/
 * 4) /Q&A/
 * 5) /Hard C and soft C guide/
 * 6) /External Resources/

Related books

 * Rhetoric and Composition/Grammar and Mechanics
 * English Grammar
 * English as an Additional Language
 * English for B2 Students

Related content

 * History
 * Dictionary
 * Thesaurus

Englisch Inglés Enseignement de l'anglais Corso di inglese אנגלית למתחילים 英語 Angielski/Okładka Inglês Englannin kieli Engelska ภาษาอังกฤษ Pratik İngilizce Tiếng Anh 英语

title: English in Use


text:
Computer Programming/Types

Computer Programming Types determine the kinds of values and how they can be used in the given programming environment. In most cases, a programming language defines a set of basic data types, e.g. for numbers, characters or strings. In higher languages, it is often possible to define new data types from the existing ones, for example, to represent a postal address (consisting of strings for street and city and integers for the postal code). When communicating data between different programs and computer systems it is important to either use types that both can recognize, or have a means of translating between them.

Type Definition
A complete definition of a data type consists of up to three things:

 * Physical representation : how is the data stored
 * Operations : what can you do with the data type (the meaning); what can you not do, such as divide by zero or string manipulation; and what happens if you "overflow" the buffers to do actions with results falling "outside" the space allotted
 * Automatic Functions : what activities, outside program control, can change the data (hardware, user, system clock)

Primitive Types
There are a few basic data types seen in some programming languages:

 * Integer : Unlimited in some languages, limited to 8-bit, 16-bit, 32-bit, 48-bit, 64-bit sizes in most languages (C, C++, C#, DDS, Java, RPG) . In some languages (Ada, FORTH, PL/I) size can be freely defined.
 * Ratios : e.g. 2/3, only a few languages have these.
 * Float : Floating point, most languages offer single and double precision (C, C++, C#, DDS, Java, RPG) . In some languages (Ada, PL/I) precision can be freely defined.
 * Decimal : Base 10 (human) fixed point, often used for monetary values. Only a few languages (Ada, PL/I, SQL, COBOL, RPG, DDS) offer fixed point. Precision can usually be freely defined.
 * Hexadecimal : Base 16 available on IBM Systems. Digits are zero through F. Most modern languages don't need a separate Hexadecimal type, they use integers and specialized I/O routines.
 * Packed Decimal : Two digits can fit into same space as one character. Look at definition of character set for ASCII, EBCDIC, or similar conceptual system.  Note letters and special characters are represented by two hexadecimal half bytes so with packed data, two digits can fit in same space as one letter.  Usually one half byte is reserved for numeric sign (plus or minus).
 * Complex : A complex value usually consisting of two Float values. Only a few languages (C99, Fortran) have these. In Object Oriented languages often implemented by a library (C++, Ada).
 * Character : A character, usually of 8, 16 or 32 bit size. Some Characters sets, like UTF-8 are for a variable length.

Composite Types

 * Record  : An assorted combination of primitive types.
 * Variant : Type is determined at runtime.
 * Object  : In Object Oriented languages.
 * Array   : See article Arrays.
 * String  : A sequence of characters. Often implemented as Array of Characters.

Type Attributes

 * Null Support : In addition to data blank or zero, we can have null value, meaning we not yet know what belongs there.
 * DBCS Double Byte Character Set : Some nations and cultures "alphabets" (such as Chinese, Japanese, Korean, Russian (Cyrillic)) can use graphical characters called ideograms to perform a role similar to the letters A to Z in western nations languages when constructing meanings, except each ideogram carries more meaning than each A to Z letter. Data types are available to store these graphical character sets, which contain more symbols than can be represented by the 256 combinations found in traditional western character sets, thus a double byte character set (DBCS) exists to account for every combination.
 * Some special fonts use a similar system.
 * Some bar coding uses similar concept.

 * Date Time and Duration    :  These are special data types used to support date math, such as calculating number days between two dates.
 * Flags or Indicators       :   They contain value like True / False or Yes / No.  They are often used to recognize use of a keyboard function (which special keys got pressed); printer condition (ready for a new page); file access (we got the record we were looking for, we're now at end-of-file).  These special conditions mean that special actions needed.
 * Variable Length : Width of data is controlled by the content.

Language Specifics

 * Ada Programming/Type System
 * C Programming/Types
 * C++ variables
 * JavaScript/Variables and Types
 * Haskell/Type basics - the language Haskell is often used as a platform for programming language researchers to develop new, advanced type systems. This wikibook could give you insight into what types might look like in the near future for the common programmer.  (Note: see also the advanced section of the Haskell wikibook)

title: Computer Programming/Types


text:
Data Structures/Arrays

Arrays
An array is a collection, mainly of similar data types, stored into a common variable. The collection forms a data structure where objects are stored linearly, one after another in memory. Sometimes arrays are even replicated into the memory hardware.

The structure can also be defined as a particular method of storing elements of indexed data. Elements of data are logically stored sequentially in blocks within the array. Each element is referenced by an index, or subscripts.

The index is usually a number used to address an element in the array. For example, if you were storing information about each day in August, you would create an array with an index capable of addressing 31 values—one for each day of the month. Indexing rules are language dependent, however most languages use either 0 or 1 as the first element of an array.

The concept of an array can be daunting to the uninitiated, but it is really quite simple. Think of a notebook with pages numbered 1 through 12. Each page may or may not contain information on it. The notebook is an array of pages. Each page is an element of the array 'notebook'. Programmatically, you would retrieve information from a page by referring to its number or subscript, i.e., notebook(4) would refer to the contents of page 4 of the array notebook.

The notebook (array) contains 12 pages (elements)

Arrays can also be multidimensional - instead of accessing an element of a one-dimensional list, elements are accessed by two or more indices, as from a matrix or tensor.

Multidimensional arrays are as simple as our notebook example above. To envision a multidimensional array, think of a calendar. Each page of the calendar, 1 through 12, is an element, representing a month, which contains approximately 30 elements, which represent days. Each day may or may not have information in it. Programmatically then, calendar(4,15) would refer to the 4th month, 15th day. Thus we have a two-dimensional array. To envision a three-dimensional array, break each day up into 24 hours. Now calendar(4,15,9) would refer to 4th month, 15th day, 9th hour.

A simple 6 element by 4 element array

Arrays guarantee constant time read and write access, $$O(1)$$, however many lookup operations (find_min, find_max, find_index) of an instance of an element are linear time, $$O(n)$$. Arrays are very efficient in most languages, as operations compute the address of an element via a simple formula based on the base address element of the array.

Array implementations differ greatly between languages: some languages allow arrays to be re-sized automatically, or to even contain elements of differing types (such as Perl). Other languages are very strict and require the type and length information of an array to be known at run time (such as C).

Arrays typically map directly to contiguous storage locations within your computer's memory and are therefore the "natural" storage structure for most higher level languages.

Simple linear arrays are the basis for most of the other data structures. Many languages do not allow you to allocate any structure except an array, everything else must be implemented on top of the array. The exception is the linked list, that is typically implemented as individually allocated objects, but it is possible to implement a linked list within an array.

Type
The array index needs to be of some type. Usually, the standard integer type of that language is used, but there are also languages such as Ada and Pascal which allow any discrete type as an array index. Scripting languages often allow any type as an index (associative array).

Bounds
The array index consists of a range of values with a lower bound and an upper bound.

In some programming languages only the upper bound can be chosen while the lower bound is fixed to be either 0 (C, C++, C#, Java) or 1 (FORTRAN 66, R).

In other programming languages (Ada, PL/I, Pascal) both the upper and lower bound can be freely chosen (even negative).

Bounds check
The third aspect of an array index is the check for valid ranges and what happens when an invalid index is accessed. This is a very important point since the majority of computer worms and computer viruses attack by using invalid array bounds.

There are three options open:

 * 1) Most languages (Ada, PL/I, Pascal, Java, C#) will check the bounds and raise some error condition when an element is accessed which does not exist.
 * 2) A few languages (C, C++) will not check the bounds and return or set some arbitrary value when an element outside the valid range is accessed.
 * 3) Scripting languages often automatically expand the array when data is written to an index which was not valid until then.

Declaring Array Types
The declaration of array type depends on how many features the array in a particular language has.

The easiest declaration is when the language has a fixed lower bound and fixed index type. If you need an array to store the monthly income you could declare in C

This gives you an array with in the range of 0 to 11. For a full description of arrays in C see C Programming/Arrays.

If you use a language where you can choose both the lower bound as well as the index type, the declaration is—of course—more complex. Here are two examples in Ada:

or shorter:

For a full description of arrays in Ada see Ada Programming/Types/array.

Array Access
We generally write arrays with a name, followed by the index in some brackets, square '[]' or round ''. For example, August[3] is the method used in the C programming language to refer to a particular day in the month.

Because the C language starts the index at zero, August[3] is the 4th element in the array. august[0] actually refers to the first element of this array. Starting an index at zero is natural for computers, whose internal representations of numbers begin with zero, but for humans, this unnatural numbering system can lead to problems when accessing data in an array. When fetching an element in a language with zero-based indexes, keep in mind the true length of an array, lest you find yourself fetching the wrong data. This is the disadvantage of programming in languages with fixed lower bounds, the programmer must always remember that "[0]" means "1st" and, when appropriate, add or subtract one from the index. Languages with variable lower bounds will take that burden off the programmer's shoulder.

We use indexes to store related data. If our C language array is called august, and we wish to store that we're going to the supermarket on the 1st, we can say, for example

august[0] = "Going to the shops today"

In this way, we can go through the indexes from 0 to 30 and get the related tasks for each day in august.

title: Data Structures/Arrays


text:
Japanese/Vocabulary/Verbs

 * The kanji for ある／いる are rarely used.
 * ¹Strictly speaking, だ/です is the copula and is verb-like, but not a verb. As such is not given a conjugation class.

Other verbs
Verbes (japonais)

title: Japanese/Vocabulary/Verbs


text:
Spanish/Lesson 7

Grammar - Preterite (el pretérito indefinido)
The following table shows the preterite of regular verbs. Regular -er and -ir verbs follow the exact same pattern. Note that the nosotros form is the same as in the present tense for -ar and -ir verbs, so you have to know the context to figure out the time. Also, note that the last letter of comí and viví has an accent mark.

Here is a list of common verbs that have an irregular preterite:

Exercise: Preterite

Grammar - Imperfect (el pretérito imperfecto)
The following table shows the imperfect of regular verbs. Note that regular -er and -ir verbs follow the exact same pattern:

There are only three verbs that are irregular in the imperfect:

Grammar - Preterite vs. Imperfect
Spanish has two tenses that correspond to the English simple past. Roughly speaking, the Preterite is used to tell What happened - it refers to a specific event.

The Imperfect is used to tell How things were - it refers to the general situation.

Exercise: Preterite vs. Imperfect

title: Spanish/Lesson 7


text:
C Programming/Arrays and strings

Arrays in C act to store related data under a single variable name with an index, also known as a subscript. It is easiest to think of an array as simply a list or ordered grouping for variables of the same type. As such, arrays often help a programmer organize collections of data efficiently and intuitively.

Later we will consider the concept of a pointer, fundamental to C, which extends the nature of the array (array can be termed as a constant pointer). For now, we will consider just their declaration and their use.

Arrays
C arrays are declared in the following form:

For example, if we want an array of six integers (or whole numbers), we write in C:

For a six character array called letters,

and so on.

You can also initialize as you declare. Just put the initial elements in curly brackets separated by commas as the initial value:

For example, if we want to initialize an array with six integers, with 0, 0, 1, 0, 0, 0 as the initial values:

Though when the array is initialized as in this case, the array dimension may be omitted, and the array will be automatically sized to hold the initial data: This is very useful in that the size of the array can be controlled by simply adding or removing initializer elements from the definition without the need to adjust the dimension.

If the dimension is specified, but not all elements in the array are initialized, the remaining elements will contain a value of 0. This is very useful, especially when we have very large arrays.

The above example sets the first value of the array to 245, and the rest to 0.

If we want to access a variable stored in an array, for example with the above declaration, the following code will store a 1 in the variable x

Arrays in C are indexed starting at 0, as opposed to starting at 1. The first element of the array above is point[0]. The index to the last value in the array is the array size minus one. In the example above the subscripts run from 0 through 5. C does not guarantee bounds checking on array accesses. The compiler may not complain about the following (though the best compilers do):

During program execution, an out of bounds array access does not always cause a run time error. Your program may happily continue after retrieving a value from point[-1]. To alleviate indexing problems, the sizeof expression is commonly used when coding loops that process arrays.

Many people use a macro that in turn uses sizeof to find the number of elements in an array, a macro variously named "lengthof", "MY_ARRAY_SIZE" or "NUM_ELEM", "SIZEOF_STATIC_ARRAY", etc.

Notice in the above example, the size of the array was not explicitly specified. The compiler knows to size it at 5 because of the five values in the initializer list. Adding an additional value to the list will cause it to be sized to six, and because of the sizeof expression in the for loop, the code automatically adjusts to this change. Good programming practice is to declare a variable size , and store the number of elements in the array in it. size = sizeof(anArray)/sizeof(short)

C also supports multi dimensional arrays (or, rather, arrays of arrays). The simplest type is a two dimensional array. This creates a rectangular array - each row has the same number of columns. To get a char array with 3 rows and 5 columns we write in C char two_d[3][5];

To access/modify a value in this array we need two subscripts:

or

Similarly, a multi-dimensional array can be initialized like this:

The number of columns must be explicitly stated; however, the compiler will find the appropriate amount of rows based on the initializer list.

There are also weird notations possible:

a[i] and i[a] refer to the same location. (This is explained later in the next Chapter.)

Strings
C has no string handling facilities built in; consequently, strings are defined as arrays of characters. C allows a character array to be represented by a character string rather than a list of characters, with the null terminating character automatically added to the end. For example, to store the string "Merkkijono", we would write

or

In the first example, the string will have a null character automatically appended to the end by the compiler; by convention, library functions expect strings to be terminated by a null character. The latter declaration indicates individual elements, and as such the null terminator needs to be added manually.

Strings do not always have to be linked to an explicit variable. As you have seen already, a string of characters can be created directly as an unnamed string that is used directly (as with the printf functions.)

To create an extra long string, you will have to split the string into multiple sections, by closing the first section with a quote, and recommencing the string on the next line (also starting and ending in a quote):

While strings may also span multiple lines by putting the backslash character at the end of the line, this method is deprecated.

There is a useful library of string handling routines which you can use by including another header file.

This standard string library will allow various tasks to be performed on strings, and is discussed in the Strings chapter.

title: C Programming/Arrays and strings


text:
Talk:Japanese/Table of Contents

Would you believe that I was just looking over my old Japanese textbook from college the other night ? Yookoso .. maybe you've seen it. Anyway I am very excited to have this project started here. The world really needs open content language textbooks ! --Karl Wick

Hello. I'm a native speaker of Japanese. Native speakers are not necessarily the best teacher, but I'll see if I can help something. :) Tomos 02:46, 14 Aug 2003 (UTC)

 * Any help you can give will be greatly appreciated Tomos !! - Karl Wick

Stevertigo speaks japanese too. He has japanese in his sig and contributes to the japanese wikipedia.LittleDan 18:20, 17 Aug 2003 (UTC)

 * Right, his sig looks kinda like a name of a superhero or a buddhist monk. :-) Tomos 19:50, 17 Aug 2003 (UTC)

How to enter characters
Is there somewhere that I can download Japanese fonts so I can read the Hiragana and Katakana on my screen ? (This box uses Mac OS 9). --Karl Wick

 * Would this help you? Japman 16:03, 19 Aug 2003 (UTC)

I think the book needs more Japanese characters. I.e. besides the romaji it needs at least the hiragana and katakana. But I haven't figured out how to type them yet... Maybe someone can give me some hints/links. I'm using the latest KDE on a Gentoo Linux system. Oh, and I'm happy to help the project with my very limited knowledge of Japanese. Guaka 19:49, 19 Aug 2003 (UTC)

 * See this grc.techtalk.linux newsgroup post (if the link doesn't work, tell me and I'll repost the information) -- Emperorbma 00:08, 21 Aug 2003 (UTC)

 * Number of links on Japanese character entry: http://www.csse.monash.edu.au/~jwb/japanese.html#links_japancomp

 * This page has instructions specific to Gentoo included: http://home.nyc.rr.com/computertaijutsu/jpninpt.html
 * More on Gentoo: http://home.no.net/david/i18n.php

 * Specific to KDE: http://katzbrown.com/shiritsu/unix%20help/japanese%20on%20kde/
 * Greyweather 04:51, 24 Jul 2004 (UTC)

Focus of the book
I would like to see some agreements on what this book is for in a bit more specific terms. Maybe not right now, but sooner or later, it should be clear.

 * Do we want to include a lot of modern Japanese for travel, daily conversation? Many idioms, potentially some slangs, etc.?
 * Do we want to offer a good book for someone who is seriously interested in business Japanese ?
 * Do we want to offer a good book for someone who would study Japanese history, literature, and/or language, so that we would want to emphasize historical backgrounds, old forms of writing, etc, and less about speaking or conversations? Do we possibly explain the language in linguistics' terms, and include some comparative perspective?
 * Do we want to make the book useful for a typical university, so that we would want to develop more specific lesson-plans, exercises, etc. for each class? Or is this more of a well-organized reference?
 * Do we assume the readers are native speakers of English? Or do we also expect some other people, who cannot get a Japanese textbook writtein in their own native languages? (Then we might use less culture-specific references, use simpler English, etc.)

Tomos 21:57, 23 Aug 2003 (UTC)

 * I personally see it as a lesson on the language and how to speak/write it. The Everyday Phrases section covers business and travel.  History covers the history aspect.  The rest is a lesson on Japanese and how to speak/write it.  The basics are covered here, and the more advanced concepts are covered in the Advanced Topics section.  The basic section should cover enough to speak and write, but probably should only cover enough for a 4 kyuu　(4級) on the JLPT (日本語能力試験), if even that...  The advanced section can focus on the JLPT and more advanced language structures and could eventually even cover up to 1 kyuu (1級). -- Emperorbma 03:09, 28 Aug 2003 (UTC)

 * sounds good to me :) Tomos 07:05, 29 Aug 2003 (UTC)

 * At the moment it seems the Japanese Wikibook is still in the early stages. I don't see any actual "Lessons" (1, 2, 3, 4, etc) listed yet. Is anyone qualified to write such lessons? Tomos has asked some very good questions. I hope as the level of Japanese increases, those topics can be covered, in Japanese, such as travel, history, business, etc. Mkn 23:54, 14 Oct 2004 (UTC)

 * At the moment, it seems our goal has become to allow the student to pass the JLPT. We could probably enrich this with additional material later, but at the moment, that is our goal. Again I say we should put our policies and goals on the Japanese/Contributor's Guide page.

Japanese Slang and curses
I think it would be best if Japanese slang and curse words were reserved for a seperate wikibook. Sound like a good idea? Greyweather 14:05, 26 Jul 2004 (UTC)

 * I agree slang and curse words are not appropriate for a standard Japanese wikibook. Maybe a Casual Japanese wikibook could be made, having connection to popular culture such as music, animation, etc where such language is used. Mkn 23:54, 14 Oct 2004 (UTC)

Splash
Tomodachi, we now have a splash graphic page. Enjoy. -- Emperorbma 03:49, 19 Dec 2003 (UTC)

ensuing discussion moved to Talk:Japanese Bignose 02 Mar 2004

Romanization style
Which romanization method are we going to use in this course? Kunrei or Hepburn? For what I've seen, different lessons use different romanization methods, which may confuse the readers. I vote for Hepburn because it's closer to Western languages and especially English, and this being a guide to Japanese for gaijin, Hepburn will seem more natural. Sabbut 09:55, 19 Dec 2003 (UTC)

 * Well, since people seemed to have been replacing the Kunrei-Shiki that I have entered in, I guess the everyone has already decided on Hepburn, so I guess we will use Hepburn... I have attempted to change all of the Kunrei I entered in back to Hepburn, but I probably missed a few... -- Emperorbma 16:08, 19 Dec 2003 (UTC)

Having had a quick look through the book, I have 2 points:

1. romanization is not constant accross pages. 2. the links to following pages should be at the bottom.

Otherwise looking good!

 * We should vote and decide on the romanization style to adopt on the Talk:Japanese/Basic Japanese sounds page. That is the page that will set the standard for the rest of the document. I cast my vote for Hepburn, because pronunciation is most important, and the kana will be nect to the romaji anyway. GoodStuff 14:47, 25 Oct 2004 (UTC)

Just a comment, so far everyone I've seen comment on this have gone for Hepburn. I'll assume hepburn then, until someone complains. If this comment is left undisturbed for a week, I'll delete the discussions concerning which romanization to use, and state that our policy has become hepburn. We should use the "contributer's guide" page as our standard. GoodStuff 06:37, 26 Oct 2004 (UTC)

Answer to focus of this book
This is my answer to what the focus of this book should be. Am I correct in the understanding that this book is supposed to be a language textbook for modern-day Japanese? If so, I have a couple suggestions.

1 Focus on the language. The whole culture section, Japanese history, anything that is not directly related to the language should be removed. I have no problems in learning about culture, etc. in the context of learning the language. However, whole separate sections on Japanese culture or whatnot should be moved to Wikipedia under the appropriate section. They don't belong here.

2 Romaji is not Japanese As an extension of focusing on the languge, there is currently way too much material on romaji. Learning about different systems of romaji is of absolutely no use in learning Japanese because romaji is NOT Japanese. Go over just enough so that people can learn to type and even then, throw it into a miscellaneous section or something to clearly indicate that _nobody_ in Japan uses romaji to communicate.

3 Language (especially Japanese) is for the dedicated You don't want to attract lazy people by using romaji letting them get away with never having to learn kana or kanji. If someone is too lazy to learn at least hiragana (I mean c'mon), he/she is doomed to fail in learning Japanese anyway. In the meantime, we can cater to those who are actually dedicated enough to at least learn the _alphabet_. The same goes for people who are too lazy to install japanese display.

-- Taekk 14:05, 30 Jan 2004 (UTC)

'''Criticism noted. Reply in sections:'''

1. I agree. Perhaps we should have History of Japan and Culture of Japan Wikibooks instead?

2. Romaji is not Japanese at all, I agree... (I should have really written a note to say that Romaji is not "real 日本語")  On the other hand, it is a useful tool for beginners to become accustomed to the idea of Kana characters if used along side them in the beginners stage. This book is as I envision it will only use Romaji/Kana for the 4級 level... The advanced sections will cover the higher level topics and will be SOLELY in Kana and Kanji beyond 3級.

3. Admittedly so, however if we keep the lazy people away, will this book have as much utility as a basic language guide so someone can start off and see if they wish to continue? Will it have the utility for the businessman who only needs some basic Japanese to converse with a client?

In order to learn a new script, you must first have lessons that use both the basic transition script (Romanization) and the native script (Kana) so that someone can get the "feel" of what the syllables sound like. After they "gain their sea legs", you can stick them on the real boat in the typhoon and see if they float.

Finally, I am not admittedly the best tutor on this topic. First, since I am only a Junior contributor, but secondly since I am not "officially versed in the language" (i.e. JLPT). This does not stop me from being able to make useful contributions, and therefore we should not exclude someone from being able to make contributions just because they are learning how to use the script properly, although we should quite certainly use pure Kana scripts in the Middle School or higher level lessons.

If Push should come to Shove, perhaps we should write "Romaji: a primer to Japanese Scripts". But seriously do we need to make Kindergarden level Kanji lessons, when even 日本人 are learning their Kana, written in ALL Kana? :P

ADDENDUM This can also open the can of worms that we should split all Language wikibooks into Basic, Intermediate and Advanced levels... That is also a possibility we can consider.

-- Emperorbma 07:17, 2 Feb 2004 (UTC)

1. If you have the time to write one, I'll read it. Though, I don't know if you can make a wikibook out of Japanese culture.

2. I'm not against using romaji to teach hiragana and sure you can throw some romaji in at the very beginning if you must. However, we must forego romaji when it becomes more of a crutch than training wheels. And seriously, how hard is it to learn hiragana? I think one or two lessons is more than enough for the reader to get the hang of it. In this respect, I think all this talk about kunrei/hepburn, blah, blah is just silly and moot. It really belongs in the appendix.

3. I don't see how teaching hiragana first won't help starters see if they want to continue. I think it's worse for the reader to invest all her time getting used to reading romaji only to find out later that she was learning the wrong thing.

Wikibooks is a free textbook project and if my idea of "textbook" is correct, than our only goal should be to teach real modern-day Japanese in the most accurate, complete, and easiest way possible. If you want to write another wikibook called "Easy business Japanese" or "Handy Japanese phrasebook" then be my guest.

4. I don't think a separate primer for romaji is necessary. Like I said, you can just throw it in a miscellaneous section. I also don't feel it's necessary to make Beginner, Intermediate, and Advanced into separate wikibooks. You can just split it up inside one book.

--Taekk 13:07, 3 Feb 2004 (UTC)

I was just voicing my reasons for the way that I have contributed. If you think it will work better without the Romaji or the Splash page (and everyone else agrees) then by all means do so. I would be happy to see the Wikibook rewritten if it is more effective at teaching the lessons. As I have said before, I am not anything close to a qualified educator on any topic, most especially a foreign language. I only have a reluctance to abandon what has not demonstrably been shown to be broken.

Yes, the Romaji is overused a quite bit... but you are dealing with mostly 外人 people who have never seen a Kana in their life. You have already covered most of my concerns with regard to this, but I would add that not everyone uses Windows... and some other Operating Systems don't make it easy to install the input method and font. As a result, you may have some people unable to read it even if they wanted to provide a reasonably decent effort. A useful solution would be a section on "how to install Japanese fonts and input". We should never abandon people because they don't know how to do something...

We agree that the only the first few basic lessons should touch on Romaji to teach the sound of Kana, so you have no arguement there. I would merely state that since we have not even reached the advanced lessons yet I didn't notice that I overdid it quite a bit.

As you see, I am not trying to stop you from fixing the problems, I was only voicing my hesitation to abandon the status quo completely. Frankly, I would like to hear some other views since you and I are the only two who have made comments. Meanwhile, if you feel that these changes must be made, this is a wiki... please feel free to make them. In fact, I think we both practically agree that it is quite unprofessional as I had written it. (That is why Verbs was totally rewritten as a matter of fact...)

*shrug* eh, that's what you get from a 外人, I suppose. :P

ADDENDUM: I can go off on tangents.... I trimmed quite a bit of redundant points.

-- Emperorbma 02:52, 4 Feb 2004 (UTC)

Cool, you can sign me on. Since I work the regular salary-man hours, I usually don't get home until at least 8:00pm so not much time to work on this but... Oh, and for the record, I am not Japanese either. 日本語入力チェックです. テスト、テスト. 本日は晴天なり --Taekk 15:23, 4 Feb 2004 (UTC)

One more comment from a 外人... I have a couple of Japanese books, one for a beginners level and the other one for an intermediate level. The former one uses kanji, hiragana and romaji in all the Japanese text, and the latter one uses kanji with its corresponding kana and no romaji. I agree with that way of teaching Japanese, and of course it's importante to tell beginners to start forgetting about the Roman alphabet ^^ Sabbut 16:09, 5 Feb 2004 (UTC)

Re: Romaji. My inclination, too, would be to avoid romaji where possible. The problem is, we can't use furigana, which is a better way of helping learners read unfamiliar kanji. As far as kana go, I think romanisation is probably unhelpful (I agree that the scope of the book shouldn't be 'Intro to Japanese', but a full language course, and this being the case, people using all but the early chapters will have to learn kana), but when it comes to kanji, they might be a necessary evil until furigana-display is possible...

Can I also suggest that wherever possible we try to avoid translating 'X は ... ' to 'as for X...' ? (Or at least of making a habit of it...) Although it conveys the general topic-markeriness of は, 'as for' is a bad translation for the simple reason that we almost never say 'as for' in English. Tremolo 03:30, 13 Feb 2004 (UTC)

 * I would concur... outside the lesson for particles that should be unnneeded. (P.S. Where else besides the は lesson did you notice that?) -- Emperorbma 21:44, 18 Feb 2004 (UTC)

 * As for this comment about as for, IMHO it's a standard part of Japanese English. ;) Personally, i just adapted to it. No culture owns the English language. And as we all know from Bladerunner, sooner or later japlish will evolve. ;) Boud 15:34, 25 Mar 2004 (UTC)

romaji vs kana, kanji discussion

i put a link to kdrill: IMHO this is excellent software for learning kanji and it seems to satisfy the free software (as in free speech) definition.

IMHO, in the spirit of the GFDL, we should encourage people to use GNU GPL (or other free software) for learning kanji (and kana of course, but that's quickly over and done with). This gets around the problem of whether this is easy or not: provide the software and it becomes easy.

In fact, my broader vision for wikipedia and wikibooks is that virtually all pages with any slightly technical content (maths, physics, language learning) should be accompanied with external links to GNU GPL or other free software. GFDL came from GPL. i often fail to do this simply because i'm not (yet) aware of where GPL or other free software is available. Boud 15:34, 25 Mar 2004 (UTC)

Kanji drawing tips
OK, time to seed the ground again... I think we could consider having some basic kanji drawing lessons that show the (most commonly accepted) basic rules for drawing kanji, such as "left to right, top to bottom" and "if boxed, outside first then inside (unless the box opens to the right)". -- EmperorBMA|話す 02:56, 22 May 2004 (UTC)

 * I've started a unified Chinese/Japanese/Korean orthography textbook at CJK. The textbook will illustrate the principles common to all three systems, so the "left to right, top to bottom" rule would certainly be included. Please contribute / comment! -- Ran 16:09, 25 Jul 2004 (UTC)

Printed sources
I found something interesting at a used bookstore today. It's a copy of Reading Japanese by Eleanor Harz Jorden and Hamako Ito Chaplin. It provides a solid start on not only learning to read kana and (425) kanji, but writing them as well. What is most useful to us though, is the following:

Copyright is claimed until December 31, 1990. Thereafter all portions of this work covered by this copyright will be in the public domain.

Is it then safe for me to copy the contents to Wikisource, or do I need to contact the publisher (Yale University) first to be sure?

 * It's fine to copy it. If it's public domain, we can use it. GoodStuff 10:43, 1 Oct 2004 (UTC)

Something missing: Dialogues...
This Wikibook seems to be coming along nicely. There's just one gaping hole: There aren't any dialogues yet. Without dialogues, we've got a phrasebook. Unfortunately I don't know enough Japanese to contribute a dialogue.

I have an idea that making the dialogues the main entrance point to the study of Japanese would be an effective teaching technique. You first learn the basics (hiragana, katakana, basic kanji concepts). Then you dive into conversations which have links to grammar notes, vocabulary, and maybe even cultural notes. I think it's important to keep the conversations in Hiragana/katakana, maybe progressing to using more and more kanji as they are learned.

I think a discussion of the structure of the material might be interesting.
 * It makes sense to group vocabulary into related groups, like they are now.
 * Dialogues would rather benefit from being divided into lessons, getting progressively more complicated.
 * Grammar is an interesting one. Do we make grammar into groups, or lessons? Do we make it run parallel to the Dialogues?

How should we approach the learning of kanji?

Some food for thought. GoodStuff 10:59, 1 Oct 2004 (UTC)

 * I hope you don't mind that I reverted this page to bring back your commentary, GoodStuff. I feel that this commentary is very important and shouldn't be removed yet :)

 * I've also noticed that dialogues are missing, it's really an important aspect to a language book. At the moment this wikibook is just like reference material without any real lessons being offered.

 * I think there's too much information about the writing scripts in this wikibook, which is covered already in wikipedia articles. However, as this is a book for studying a foreign language, I think there should be allowance for romaji inclusion. Otherwise we might be pushing away readers who are true beginners to the language. JLPT 4 allows romaji, JLPT 3 to JLPT 1 uses only Japanese.

 * As for grammar and particles, I believe it should be explained briefly when first introduced in a lesson so the reader has an understanding and feel for the language. There's already a grammar reference list at . But most pages here needs to be made more clear for ease of reading.

 * On kanji, it should be introduced according to JLPT kanji. We have JLPT Level 4 Kanji which is good for a print out. Although other websites provide a better resource to study kanji. Also, there's a wikibook on East Asian orthography at CJK which will be useful for readers to understand how kanji is written. — Mkn 10:45, 19 Oct 2004 (UTC)

 * I do not mind at all! No one responded to my comments, and this discussion page is already cluttered. I did not want to contribute to the clutter.

 * I must say I disagree with the current "Japanese writing system" page layout. The page is somewhat overspecialized, and as a summary, it is not clear enough. It uses far too much jargon as well. I edited it somewhat.

 * Okay, dropped the page from menu, added  which should introduce our chosen romaji style. Again, I vote for Hepburn aka Hebon-shiki. Feel free to edit my (terrible) introduction to the sounds of the Japanese language. The sounds and mora concepts so introduced gives us a nice platform to explain the writing system from. This is that I've attempted to do with my slight editing of the Japanese/Japanese writing system page. We can't throw newbies into the deep end on that page, even if there are great references for Kana and Kanji. See my comments at the writing system discussion page. GoodStuff 16:32, 25 Oct 2004 (UTC)

Layout and Focus
I think one of the main things needed right now is a better overall layout. If someone who wishes to learn japanese comes to the main page of the Japanese wikibook, they're not going to know where to start. "What, do I just read top-to-bottom?"

Having sections seperated up into grammar, vocabulary lists, and such is useful if you know what you're looking for, but if you're trying to learn the language, it needs to be more structured.

I think a neat approach would be to have sequentially numbered vocabulary lists, with the more useful vocab in the earlier lists. At the top of each grammar/usage lesson, we could specify which vocabulary lists are going to be used in the dialogues and with the examples in the lesson. Finally, you bundle a certain amount of vocabulary and grammar into a 'chapter' (where nothing from a later chapter is used within, all of the vocab in the grammars are contained in the vocab lists or have already been learned, and where it makes sense to be learning all of that as one unit). It would also be useful (though I'm not quite sure what the capability of the wiki books software is) to have quizzes at the end of each chapter, quizzing on everything contained within. It would also be nice to have the chapters planned out a couple in advance, similar to how the Korean wikibook does it: http://en.wikibooks.org/wiki/Korean

It would also give the book discrete units in which you could only put romaji within the first 3 lessons, or something like that. So, it's very obvious where one should and shouldn't use romaji. The list of chapters should probably be the main focus of the book, following just after the intro and such. After the list of chapters could be an index of grammars and vocab and such.

Also, on a different topic, it might not be possible to use furigana in the wikibook as it is, but it'd be nice to have a very strict standard to express furigana, so that when converting to print or to another format, a preprocessor of some sort could very easily convert all of the kana to furigana. Something simple like the word in kanji followed by the word in kana in parenthesis would do. --Xepo 19:21, 14 Oct 2004 (UTC)

I took an hour or so and wrote up what I think would be decent for the first few chapters and intro. I didn't want to just modify the main page, as I'm still relatively new here, but take a look at this, see whacha think, feel free to post it as the main page. It's a pretty rough outline, but I think it's fairly well though-out: JapaneseTable_of_ContentsTest

--Xepo 20:29, 14 Oct 2004 (UTC)

Um, I don't mean to intrude, but the Table of Contents is totally off right now. To get to many sub pages, I have to jump into certain pages and use internal "next" or "previous" links to get to the pages that I refer to rather often.

 * I'm sorry Xepo, that's my fault I guess. I was editing the TOC list. Which pages in particular are troublesome? (d'ah, forgot to sign... also I'll try to add links back to TOC in the subpages if that helps) — Mkn 02:19, 18 Oct 2004 (UTC)

 * Eheh, sorry, it wasn't Xepo, it was me, an unregistered user. It looks awesome now, though, thanks!  This is undoubtedly one of the best resources on the web for learning language thanks to you guys and your dedication.

Great new layout! Still, dialogues would be nice. GoodStuff 09:07, 19 Oct 2004 (UTC)

Yea, the new TOC looks a lot better, btw. Good job. I think it could still use a bit of direction, but that'll come as the book progresses. --Xepo 05:21, 29 Oct 2004 (UTC)

In the interests of better communication...
Hi. I think we have a serious problem here. In Wikipedia people don't need to communicate as much to fix a spelling mistake, or to add content, because each page is well defined and about a specific topic.

Here however, I think we have the additional problem of the organization and layout of the Wikibooks. I suggest therefore that we start a mailinglist and/or IRC chatroom to discuss the issues of this wikibook. I feel the discussion page is inadequate. I made the effort to start such a mailinglist. Here's the link: http://groups.yahoo.com/group/japanese_wiki/ Take note that my nick on Yahoo is BraineX and not GoodStuff. GoodStuff 08:35, 29 Oct 2004 (UTC)

title: Talk:Japanese/Table of Contents


text:
Calculus

Welcome to the Wikibook of Calculus

This wikibook aims to be a high quality calculus textbook through which users can master the discipline. Standard topics such as limits, differentiation and integration are covered, as well as several others. Please contribute wherever you feel the need. You can simply help by rating individual sections of the book that you feel were inappropriately rated!

 * Introduction
 * Contributing
 * Resources

Acknowledgements and Further Reading
Cálculo_en_una_variable Kalkulus 解析学基礎 Cálculo_(Volume_1) Analyse 微积分学

title: Calculus