Category:C

  • Classical sorting algorithm

    Time:2020-12-1

    Classical sorting algorithm Create three files: sortarray. H, sortarray. C, sortarraytest. C. sortArray.h #ifndef SORT_ARRAY_H_ #define SORT_ARRAY_H_ //Function: compare two data //Parameters: a (data a), B (data B) //Return: a > B returns a positive number, a sortArray.c #include #include #include “sortArray.h” //Function: print the error message and exit the program //Parameters: expression (error judgment […]

  • Command, menu and shortcut key of vscode plug-in development

    Time:2020-12-1

    command We have already mentioned command writing in the previous chapter of Hello word. Let’s review it here. context.subscriptions.push(vscode.commands.registerCommand(‘extension.sayHello’, () => { vscode.window.showInformationMessage (‘you did extension.sayHello Command! ). })); Then declare in the manifest file: “commands”: [ { “command”: “extension.sayHello”, “title”: “Hello World” }, ] vscode.commands.registerCommandIs the API that registers the command. After execution, it […]

  • Circular queue – sequential storage

    Time:2020-11-30

    Array to achieve circular queue Create three files: queuearray. H, queuearray. C, and queuearraytest. C queueArray.h #ifndef QUEUE_ARRAY_H_ #define QUEUE_ARRAY_H_ #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif #define ADT QueueArray //Function: the process of comparison between a and B //Parameters: A, B //Return: a > […]

  • Implementation of developing stm32f4 with vscode + platformio

    Time:2020-11-30

    My computer environment win10 vscode 1.36.1 Vscode install plug-in After installing the plug-in, you will be prompted to install the platform core. Follow the instructions to install. The installation process may be slow and may need to climb over the wall New project Select the model of the board and the frame to be used […]

  • Circular double ended queue sequential storage

    Time:2020-11-29

    Array implementation of circular double ended queue Create 3 files: doubleendedqueuearray. H, doubleendedqueuearray. C, doubleendedqueuearraytest. C doubleEndedQueueArray.h #ifndef DOUBLE_ENDED_QUEUE_ARRAY_H_ #define DOUBLE_ENDED_QUEUE_ARRAY_H_ #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif #define ADT DequeArray //Function: the process of comparison between a and B //Parameters: A, B //Return: a […]

  • The function of jump to definition, automatic completion and hover prompt of vscode plug-in development strategy

    Time:2020-11-29

    Jump to definition Jump to the definition is actually very simple, through thevscode.languages.registerDefinitionProviderSign up for oneproviderThis oneproviderIf you returnnew vscode.Location()It means that the current cursor word supports jump, and jump to the corresponding location. To make the example more meaningful, I write a support herepackage.jsonindependencies、devDependenciesExample of jumping to the corresponding dependent packagejump-to-definition.js(of course, we just […]

  • Binary heap sequential storage

    Time:2020-11-28

    Implementation of binary heap by array Create three files: heaprarray. H, heaprarray. C, heapararraytest. C heapArray.h #ifndef HEAP_ARRAY_H_ #define HEAP_ARRAY_H_ #ifdef __GNUC__ #define DEPRECATED __attribute__( (deprecated) ) #elif defined(_MSC_VER) #define DEPRECATED __declspec( deprecated ) #else #define DEPRECATED #endif #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif […]

  • Implementation of Linux UDP server and client program

    Time:2020-11-28

    1. Source code UDP server: /** *@ brief UDP server * @author Mculover666 * @date 2020/04/15 */ #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdlib.h> #include <string.h> int main(int argc, char* argv[]) { int server_sock_fd; struct sockaddr_in server_addr, client_addr; char recv_buf[100]; int nbytes = 0; socklen_t len = 0; […]

  • Stack chain storage

    Time:2020-11-27

    Linked list implementation stack Create three files: stacklinked. H, stacklinked. C, stacklinkedtest. C stackLinked.h #ifndef STACK_LINKED_H_ #define STACK_LINKED_H_ #ifdef __GNUC__ #define DEPRECATED __attribute__( (deprecated) ) #elif defined(_MSC_VER) #define DEPRECATED __declspec( deprecated ) #else #define DEPRECATED #endif #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif #define ADT […]

  • Help vs2019 recover the lost SDK

    Time:2020-11-27

    origin Some time ago, some netizens encountered a strange problem, saying that he was on the machinevs2019compileC++Engineering report error. At that time, I had two doubts 1. The project setting is wrong. 2.vs2019It’s not installed. Since the simplest project is created, the compiler will report the same error, so the problem of project settings can […]

  • Queue chain storage

    Time:2020-11-26

    Linked list realizes queue Create three files: queuelinked. H, queuelinked. C, queuelinkedtest. C queueLinked.h #ifndef QUEUE_LINKED_H_ #define QUEUE_LINKED_H_ #ifdef __GNUC__ #define DEPRECATED __attribute__( (deprecated) ) #elif defined(_MSC_VER) #define DEPRECATED __declspec( deprecated ) #else #define DEPRECATED #endif #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif #define ADT […]

  • Vscode changes all the same variable name or class name at the same time

    Time:2020-11-26

    Sometimes we want to change the name of a variable or class in the codeBut if it is changed, many places will be changed togetherIt would be a waste of time to change everything one by one So we need some way to change all the same variable or class names at the same time […]