Example 1:
Program READENV.C shows several techniques for accessing environment variables in C language. The program prints out all the current environment variables in the same format as the DOS SET command, then looks for the path variable and
The following is the code that implements the string substitution function in the C language:
Char *replace (char *source, Char *sub, char *rep){Char *result;/*PC1 is the scan pointer copied to result results./*PC2 is the auxiliary pointer to scan
The main features of C language are: Strong function, easy to use and flexible. C compiled programs are not as strict as other high-level languages. This gives programmers the "flexibility", but still because of this flexibility to debug the program
Statements in a program are usually performed in sequential direction, or in the direction defined by the statement function. If you need to change the normal flow of your program, you can use the transfer statement described in this section. There
The circular structure is a very important structure in the program. It is characterized by repeated execution of a section of a program when a given condition is established, until the condition is not tenable. Given conditions called cyclic
relational operators and expressions
It is often necessary to compare the two-magnitude relationship in a program to determine the next step in the program's work. An operator that compares two quantities is called a relational operator. The
Data output Statement
This section describes statements that output data to a standard output device display. In C, all data input/output is done by the library function. So it's all a function statement. This section introduces the printf function
#include #include int main (){int a[31][31], I, J, M, n, p = 0;while (P = = 0){System ("clear");printf ("Please enter an odd number not greater than 30:");scanf ("%d", &m);if (M!= 0 && m Break}for (i = 1; I for (j = 1; j A[I][J] = 0;j = i/2 + 1;A[1][
* * This is Peng Bo classmate's push box game, we try to play, who has better idea? */
#include "stdio.h"#include "Bios.h"#define LEFT 75#define RIGHT 77#define UPPER 72#define DOWN 80#define ESC 27struct BOXSS/* Defines the box structure, which
Dark clouds Teacher's words: Learning to detect keyboard information, Yu Wenbiao classmate Classroom made a keyboard in the screen up and down to move a star program.
The teacher gave a few students the idea of the Maze game, Peng Bo students next
Determines whether a particular character is a ASCII character.
int __isascii( int c ); int iswascii( wint_t c );
Test program:
#include "stdafx.h" #include "ctype.h" #include "locale.h" #include "stdio.h" void CheckCharAndPrint(char acChar) {
Prototype: extern char *strstr (char *haystack, char *needle);
Usage: #include
Function: Looks for the first occurrence of the needle from the string haystack (does not compare the Terminator null).
Description: Returns a pointer to the first
Prototype: extern char *strpbrk (char *s1, char *s2);
Usage: #include
Function: In string s1, find the position of the first character in the string S2 that matches any one character, NULL is not included.
Description: Returns a pointer to the
Prototype: extern int strnicmp (char *s1,char * s2,int N);
Usage: #include
Function: Compares the first n characters of a string S1 and S2 but is case-insensitive.
Description: Strncmpi is a macro definition to strnicmp
When S1
When S1=s2, the
Prototype: extern char *strncpy (char *dest, char *src, int n);
Usage: #include
Function: Copy the first n bytes of the null-terminated string from SRC to the dest-point array.
Description
If the first n bytes of SRC contain no null characters,
Prototype: extern int strcmp (char *s1,char * s2,int N);
Usage: #include
Function: Compares the first n characters of a string S1 and S2.
Description
When S1
When S1=s2, the return value =0
When S1>s2, the return value >0
Example:
//
This is a C-language implementation of polynomial division code example, polynomial division and polynomial multiplication and subtraction, more difficult to achieve, so has been a variety of textbooks and teachers taboo, so small Hong today will
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.