- A computer program, also called software, is a way to tell a computer what to do.
- FunctionMost languages allow you to create functions of some sort. Functions let you chop up a long program into named sections so that the sections can be reused throughout the program. Functions accept parameters and return a result.
- Every library consists of two parts: a header file and the actual code file. The header file, normally denoted by a .h suffix, contains information about the library that programs using it need to know. In general, the header file contains constants and types, along with prototypes for functions available in the library.
- printf - prints formatted output to stdout
- scanf - reads formatted input from stdin
- puts - prints a string to stdout
- gets - reads a string from stdin
- putc - prints a character to stdout
- getc, getchar - reads a character from stdin
- fopen - opens a text file
- fclose - closes a text file
- feof - detects end-of-file marker in a file
- fprintf - prints formatted output to a file
- fscanf - reads formatted input from a file
- fputs - prints a string to a file
- fgets - reads a string from a file
- fputc - prints a character to a file
- fgetc - reads a character from a file
C uses pointers in three different ways:
- C uses pointers to create dynamic data structures -- data structures built up from blocks of memory allocated from the heap at run-time.
- C uses pointers to handle variable parameters passed to functions.
- Pointers in C provide an alternative way to access information stored in arrays. Pointer techniques are especially valuable when you work with strings. There is an intimate link between arrays and pointers in C.
The text editor is a programmer's intimate link to the computer
A process may start many threads or other processes, but a thread cannot start a process.
You can think of the word
static
as meaning "no matter how many objects are made, there will be only one of these."
Network
The following is an example of a URL which addresses the Java Web site hosted by Sun Microsystems:
![](https://i-blog.csdnimg.cn/blog_migrate/357fdb17ff360a92412b6099a186e25e.gif)
- Protocol identifier
- Resource name
The resource name contains one or more of the components listed in the following table:
Host Name | The name of the machine on which the resource lives. |
---|---|
Filename | The pathname to the file on the machine. |
Port Number | The port number to which to connect (typically optional). |
Reference | A reference to a named anchor within a resource that usually identifies a specific location within a file (typically optional). |
Here's the output displayed by the program:import java.net.*;
import java.io.*;
public class ParseURL {
public static void main(String[] args) throws Exception {
URL aURL = new URL("http://java.sun.com:80/docs/books/"
+ "tutorial/index.html#DOWNLOADING");
System.out.println("protocol = " + aURL.getProtocol());
System.out.println("host = " + aURL.getHost());
System.out.println("filename = " + aURL.getFile());
System.out.println("port = " + aURL.getPort());
System.out.println("ref = " + aURL.getRef());
}
}
protocol = http
host = java.sun.com
filename = /docs/books/tutorial/index.html
port = 80
ref = DOWNLOADING