String functions (strlen,strcpy,strcat,strcmp,strstr,strtok)
catalogue
I strlen - string length
1. Function introduction
2. Simulation Implementation
II strcpy - string copy
1. Function introduction
2. Simulation Implementation
3. strncpy
III strcat - string append
1. Function introduction
2. Simulation Implementation
3.strncat
IV strcmp - string comparison
1. Function introduction
2. Sim ...
Posted by jana on Sat, 26 Feb 2022 06:00:27 +0100
Detailed explanation of mutual call between C language and Lua
Write a C to call Lua's Demo to compile and run
add.c content
//How many files do you need to include
#include <stdio.h>
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
lua_State* L;
int
luaadd(int x, int y)
{
int sum;
/*Function name*/
lua_getglobal(L,"add");
/*Parameter stack*/
lua_pushnumber(L, x);
/*Parameter ...
Posted by lcoscare on Sat, 26 Feb 2022 04:01:53 +0100
C language -- 2. Notes on pointer array and array pointer and function pointer
1. Pointer array and array pointer concept (1) Pointer array: it is an array of pointers, and the elements in the array are arrays. (2) Array pointer: it is a pointer to an array, a pointer to an array. 2. Expression
(1)int *p[5]
// Pointer array, combined with square brackets of p, is an array, so it is a pointer array
// This array has fi ...
Posted by Iceman512 on Sat, 26 Feb 2022 01:35:05 +0100
HNUST-C language course design completion quality test record·
Write before:
It's time for the c language class, which has been watered for more than a week, to come to an end
--Here's Friday's "C language course design completion quality test", a salute to the sky
1. display of main menu
Small management systems generally display the main menu first. Now please design a simple main m ...
Posted by digitalbart2k on Fri, 25 Feb 2022 16:58:06 +0100
The classical "poor cow" problem is described in C language
The classical "poor cow" problem is described in C language
subject
Problem description
Farmer John has n (n ≤ 10000) cows. However, because they produced too little milk, the farmer was very dissatisfied with them and decided to make the least milk into beef jerky every day. But still a little reluctant, John plans to be mercif ...
Posted by broann on Fri, 25 Feb 2022 02:36:48 +0100
C language: Brush question summary
C language learning has come to an end. This paper is a summary of the recent learning of C language. Most of the questions come from niuke.com.
Topic 1: integer conversion
Title Description: write A function to determine how many bits need to be changed to convert integer A to integer B.
Idea: in fact, this problem is actually to find how m ...
Posted by Hardwarez on Thu, 24 Feb 2022 16:22:17 +0100
C language array
1. Creation and initialization of one-dimensional array
1.1 creation of array
type_t arr_name [const_n];
//type_t is the element type of the index group
//const_n is a constant expression that specifies the size of the array
//Code 1
int arr1[10];
//Code 2
int count = 10;
int arr2[count];//Try to avoid the array length as variable (vari ...
Posted by yakabod on Wed, 23 Feb 2022 17:14:46 +0100
Day 23 IO flow
IO: refers to the flow of data transfer between devices
Classification by flow direction:
Input stream
Output stream
Classification by data type:
Byte stream
A: Byte input stream
FileInputStream:
FileInputStream fis = new FileInputStream("file name of read data");
Byte buffered input stream: BufferedInputStream
Bufferedinput ...
Posted by guiltyspark on Wed, 23 Feb 2022 13:39:05 +0100
Basic C language day4
review
Conditional operator
Expression 1? Expression 2: expression 3
Expression 1 is true and the result is the result of expression 2; Otherwise, it is the result of expression 3.
sizeof() operator
The memory length of calculation types and variables, in bytes
int 4
char 1
float 4
short 2
double 8
++Self increasing -- self decreasin ...
Posted by techgearfree on Wed, 23 Feb 2022 12:37:15 +0100
C language foundation day2
review
Use of vim editor:
vi file name
vi test. c . C language source file
Key i: enter the input mode and insert appears in the lower left corner
esc key: exit the input mode. The insert in the lower left corner is gone
: wq save and exit vi editor
:q! Force exit without saving
:wq! Force save exit
#include <stdio.h>
//#Prepr ...
Posted by trippyd on Wed, 23 Feb 2022 12:32:43 +0100