What is the computer program?

  • 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:

As in the previous diagram, a URL has two main components:
  • 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).

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());
}
}
Here's the output displayed by the program:
protocol = http
host = java.sun.com
filename = /docs/books/tutorial/index.html
port = 80
ref = DOWNLOADING
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值