weiwuwei
BAN USER#include <stdio.h>
#include <string.h>
int reverse(char* str)
{
char* head =str;
char* tail = head + strlen(str)-1;
char temp;
do{
temp = *head;
*head = *tail;
*tail = temp;
}while(head++ < tail--);
printf("the output is %s\n",str);
return 0;
}
int main()
{
char a[] = "abcdefghijk";
int ret = reverse(a);
printf("the output is %s\n",a);
return 0;
}
SAX:
Parses node by node
Doesn’t store the XML in memory
We cant insert or delete a node
SAX is an event based parser
SAX is a Simple API for XML
doesn’t preserve comments
SAX generally runs a little faster than DOM
DOM:
Stores the entire XML document into memory before processing
Occupies more memory
We can insert or delete nodes
Traverse in any direction.
DOM is a tree model parser
Document Object Model (DOM) API
Preserves comments
SAX generally runs a little faster than DOM
In computer programming, a function may be described as pure if both these statements about the function hold:
The function always evaluates the same result value given the same argument value(s). The function result value cannot depend on any hidden information or state that may change as program execution proceeds or between different executions of the program, nor can it depend on any external input from I/O devices.
Evaluation of the result does not cause any semantically observable side effect or output, such as mutation of mutable objects or output to I/O devices.
This only works if the requirement is no duplicate numbers
- weiwuwei March 30, 2013