language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdlib.h> #include <string.h> #include <stdio.h> char** expr; void swap(int* arr, int i, int j) { int x = arr[i]; arr[i] = arr[j]; arr[j] = x; } void swap_str(char** arr, int i, int j) { char* x = arr[i]; arr[i] = arr[j]; arr[j] = x; } void solve24pt(int* arr, int start, int end, int...
C
/* EMS - file_length.c POSIX Style text file length search Copyright (C) 2021 Naive-C <naive.c.cell@gmail.com> */ #include <sys/stat.h> size_t file_length(const int fd) { struct stat st; fstat(fd, &st); size_t size = st.st_size; return size; }
C
#include <stdio.h> #include <stdlib.h> void lerVetor(int *, int); void construirMinHeap (int *, int); void descer (int *, int, int); void mostrar(int *, int); int main() { int n, *v; v = (int *)malloc(sizeof(int)); scanf("%d", &n); while (n != 0) { v = (int *)realloc(v, n * sizeof(int)); ...
C
#ifndef FALLING_LETTER #define FALLING_LETTER #include "Computer.h" #include "fonts.h" struct FallingLetter : public ScreenElement { int sign; float rotation_angle; FallingLetter(float _x1, float _y1, float _x2, float _y2, string _name) : ScreenElement(_x1, _y1, _x2, _y2, _name) { sign = 2; } ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAXLINE 1000 int except = 0; int number = 0; void findpattern(char *fname, char *pattern); void handlematch(FILE *fp, char *fname, char *pattern); int main(int argc, char *argv[]) { char line[MAXLINE]; char *prog = argv[0]; int c; w...
C
#include<stdio.h> #include<math.h> main() { long long int i,t,j,k,l,cnt=0,p,A,B,C,D,x,y,m,n,a[100][2]; scanf("%lld",&t); for(i=0;i<t;i++) { cnt=0; scanf("%lld %lld %lld %lld %lld %lld %lld %lld",&n,&A,&B,&C,&D,&x,&y,&m); a[0][0]=x; a[0][1]=y; for(j=1;j<n;j++) {x=(A*x+B)%m; y=(C*y+D)%m; a[j][0]=x; a[j][1]=y; } for(k=0;k...
C
//============================================================================== /* MBUG-2151 interface implementation Mostly identical to mbug_2165.c, but without carrier modulation. Any changes in this file should also be applied in mbug_2165.c. */ //=============================================================...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> static unsigned int CHARACTERS_ASCII = 91; typedef struct TMyStruct { unsigned char key[7]; unsigned long long value; } TMap; void RadixSort(TMap *source, unsigned long int size) { TMap *tmp; int i; unsigned int j; unsigned long long c...
C
// Name of coder : Mangesh Chandrawanshi // Roll No : 1801CS16 // Date created : 26th Mar 2019 // Brief objective of the program : Complete task given in Assignment 8 #include <stdio.h> // Structure Definition typedef struct student{ int roll_number; char grades[6]; float CGPA; }student; // Function I to...
C
#include<stdio.h> #include<conio.h> int main(void) { int X[10][10],n,i,j,flag; printf("How many columns and rows?\n"); scanf("%d",&n); printf("Enter the elements\n"); for(i=0;i<n;i++) { for(j=0;j<n;j++) { scanf("%d",&X[i][j]); } } flag=1; for(i=0;i<n;i++) { for(j=i+1;j<n;j++) ...
C
#define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> #include <errno.h> #include <unistd.h> #include <sys/msg.h> #include <ctype.h> #include <time.h> #include <signal.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/mman.h> #include <semaphore.h> #include <fc...
C
#pragma once typedef int BTDataType; typedef struct BinaryTreeNode { struct BinaryTreeNode* _left; struct BinaryTreeNode* _right; BTDataType _data; }BTNode; #include "Queue.h" #include "Stack.h" BTNode* BuyBTNode(BTDataType x); // BTNode* CreateBTree(BTDataType* a, size_t* pIndex, BTDataType invalid); void ...
C
#ifndef FL_RANGE_H #define FL_RANGE_H #include "FuzzyLib.h" #include "Real.h" #include <stdlib.h> struct FL_EXPORT Range { Range(Real a = NotANumber, Real b = NotANumber) { this->a = a; this->b = b; } Range(const Range& o ) { *this = o; } Range& operator = (const Range& o ){ this->a = o.a; this->b = o.b...
C
/* Program 7.8 Getting the values in a two-dimensional array */ /* Jedi Chou - 20130812-1407 */ #include <stdio.h> int main(void) { long board[3][3] = { {'1', '2', '3'}, {'4', '5', '6'}, {'7', '8', '9'} }; /* List all elements of the array */ for(int i=0; i<9; i++) { printf("Board: %c\n", *(...
C
#include <stdio.h> #include <stdlib.h> int main(){ int num, num2 ; num = 20; num2 = 5; int soma = num + num2; printf("A soma eh igual a : %i\n", soma); int subtracao = num - num2; printf("O valor da subtracao eh igual a : %i\n", subtracao); int divisao = num / num2; printf("O va...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <float.h> #include <sys/timeb.h> /* WordRank - by Greg Scaffidi This program finds the "rank" of a given word compared to other words that can be made by re-arranging the letters of the given word. Any unique combination of letters will be consi...
C
#include "util.h" #include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> void heap_adjust(int* a, int s, int n) { int tmp = a[s]; for (int i = s << 1; i <= n; i <<= 1) { if(i < n && a[i] < a[i + 1]) i ++; if(a[i] <= tmp) break; a[s] = a[i]; s = ...
C
#include <timeutils.h> void addmsec(int32_t *year, int32_t *day, int32_t *msec, int32_t delta) { int16_t year1, day1; double sec1, unixTime; unixTime = yds2unix(*year, *day, *msec/1000.0) + delta/1000.0; unix2yds(unixTime, &year1, &day1, &sec1); *year = year1; *day = day1; *msec = sec1*1000.0; }
C
/** * This file, alder_thread_argument.c, is part of alder-thread. * * Copyright 2013 by Sang Chul Choi * * alder-thread is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, ...
C
#include "Record.h" #include <stdlib.h> #include <string.h> Record * create_record (const char * phone, const char * lastname, const char * firstname,const char * town, float amount) { Record *record = (Record *) malloc(sizeof(Record)); if(record == NULL) return NULL ; memset(record->ph...
C
#include <stdio.h> #include <errno.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/socket.h> #include <string.h> #include <unistd.h> #include <netdb.h> #include <sys/types.h> #include <netinet/in.h> #define BUFFER_SIZE 1500 //maximum tcp packet size #define BACKLOG 5 // quantidade de requests até trocar os...
C
#include <stdio.h> #include <stdlib.h> r int spellCheck(char word[],FILE* open){ //fseek(open,0,SEEK_SET); // words belongs the mains threads, i want each thread to start at the beginning char compare[20]; fgets(compare,sizeof(compare),open); while(compare != NULL){ if(strcmp(compare,word)==0){ ...
C
/* * PROJECT 5: NEH Algorithm on Flow Shop Functions Author: Holly Strauch CS 471 Project 5 May 31, 2019 This program runs the NEH algorithm on three functions: Flow Shop Scheduling (FSS), Flow Shop with Blocking (FSB), and Flow Shop with No Wait (FSNW). It is a combinatorial algorithm which attempts to find the o...
C
/* * rgb color convert: * ---> hex 00 00 00 ~ ff ff ff * ---> hsl hue(0~360) saturation(0~1) lightness(0-1) * ---> hsb/hsv hue(0~360) saturation(0~1) value/brightness(0-1) * ---> cmyk cyan(0-1) magenta(0-1) yellow(0-1) black(0-1) */ #include <stdio.h> #include <string.h> typedef struct...
C
// Unit Test Framework Includes #include "atf.h" // File To Test #include <stdc.h> #include <bstree.h> typedef struct { bstree_node_t node; int val; } int_node_t; int compare(bstree_node_t* a, bstree_node_t* b) { int_node_t* nodea = container_of(a, int_node_t, node); int_node_t* nodeb = container_of(...
C
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 long long dp[100005]; long long power(long long N, long long expo) { long long ans = 1; cout << "came inside power with n="<< n<< " and expo ="<< expo<< endl; while(expo) { cout << "came inside while with expo ="<< expo<< endl; ...
C
#include <stdio.h> #include <stdlib.h> #include "LinkedList.h" #include "envios.h" #include "parser.h" #include "validaciones.h" //int idMaxArray(LinkedList* pArrayLibros); /** \brief Carga los datos desde el archivo data.csv (modo texto). * * \param path char* * \param pArrayListEmployee LinkedList* * \return int...
C
#ifndef VARIADIC_FUNCTIONS_H #define VARIADIC_FUNCTIONS_H #include <stdarg.h> /** * struct op - points to list of args in op_t * @op: operator points to column 0 opt_t * @f: points to functions in coumn 1 op_t * */ typedef struct op { char *op; void (*f)(); } op_t; void print_all(const char * const format, ....
C
/* Luke Winker 22 January 2019 Software Engineering */ #include <stdio.h> int main() { printf("The size of int is %1u \n", sizeof(int)); printf("The size of char is %1u \n", sizeof(char)); printf("The size of long is %1u \n", sizeof(long)); printf("The size of float is %1u \n", sizeof(float)); printf("Th...
C
// FUNCTIONS TO CORRECTLY READ THE CONFIGURATION FILE #define CONFIG "datarepo.conf" //name of the configuration file #define COMMENT '#' //character that defines a comment line #define MAX_ARGS 2 //every line is structured as lhs=rhs, so the tokenize array only needs 2 fields void readConfig (short unsigned...
C
#include<stdio.h> #include<math.h> #define szer 50 #define wys 40 #define dol_x -0.9 #define gora_x 8 #define dol_y -2.5 #define gora_y 2.5 float funkcja_a (float x) { return x*x*x/27 - x*x*2/9 + x/3 + 2; } float funkcja_b (float x) { // return ((x-2)*x-1)*x+2; return log(x+1); } char rysunek[szer][wys]; void r...
C
#include <stdio.h> int linearRecursive(int arr[], int el, int i, int end) { if (i < end) { if (arr[i] == el) return i; else return linearRecursive(arr, el, i + 1, end); } return -1; } void main() { int x[] = {9, 6, 4, 24, 56, 34, 23, 6, 7, 34, 23}; int t...
C
/** @brief: Este programa configura el BCM_GPIO 17 usando la libreria wiringPi * El GPIO 17 corresponde con el pin 0 en wiring Pi * Se debe compilar con: gcc gpio.c -o gpio -lwiringpi * * * gcc gpio.c -o gpio -lwiringPi * * */ #include<stdio.h> #include<unistd.h> #include<wiringPi.h> int main( ) { //Se in...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #define dim 3 #define size_dim 129 #define size (size_dim*size_dim*size_dim) void read_turbulence(double **turb_array) { printf("Reading grid turbulence file\n"); FILE *turb_in = fopen("turbulence19.txt", "r"); /// file generated by the turbulence_gener...
C
//SINGLY LINKED LIST IMPLEMENTATION IN C LANGUAGE: #include <stdio.h> #include <stdlib.h> #include <conio.h> struct node{ int data; struct node * next; }*head=NULL; void insertbegin(int x); void insertmid(int x); void insertlast(int x); int deletebegin(); int deletelast( ); int deletemi...
C
#ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdlib.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <errno.h> #include "E_Ofono.h" static void _method_success_check(void *data, DBusMessage *msg __UNUSED__, DBusError *error) { const char *name = data; if ((!error) || (!dbus_e...
C
void L06_TF1(){ //canvas 1 TCanvas * c1 = new TCanvas(); //first method to define a fucntion TF1 * f1 = new TF1("f1","sin(x)/x", 0,3); f1->Draw(); double x0 = 0.001; double fx0 = f1->Eval(0.001);//Evaluate the value of f1 in point x0 printf("The value of f1 at point x0 is: f1(%lg) = %lg \n",x0,fx0); double...
C
// // Created by Greg Postnikoff // #ifndef ONEGINBRAT_FUNCTION_H #define ONEGINBRAT_FUNCTION_H int StrcmpReverse( const void * str1, const void * str2 ) { Text * s1 = (Text *) str1; Text * s2 = (Text *) str2; int leng = 0; int FirstPunct1 = 0, FirstPunct2 = 0; while (ispunct(s1->str[s1->len ...
C
#include <stdio.h> #include <stdlib.h> char destChar[3]; char srcChar[3]; int width; int height; int startX, startY; int endX, endY; char fileName[128] = {0}; char buf[1024] = {0}; void readConf() { printf("ļ:"); memset(fileName, 0, sizeof(fileName)); scanf("%s", fileName); printf(" (width), (height):"); sca...
C
#ifndef __TREE_H__ #define __TREE_H__ #ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif #include <stdio.h> #include <stdlib.h> #include <stdbool.h> typedef struct Node_ { struct Node_ *left; struct Node_ *right; int data; } Node; typedef struct { Node *root; } Tree; Tree *tree_create(int val); vo...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print_instructions.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include "store.h" store *createStore(void *datas, void(*prPtr)(void* info)){ store *ptr = malloc(sizeof(store)); ptr->printPtr = prPtr; ptr->data = datas; return ptr; } void displayStore( store* s ){ s->printPtr(s->data); }
C
#include<stdio.h> int MulDigit(int iNo) { int iDigit=0, iMul=1; while(iNo != 0) { iDigit = iNo % 10; if(iDigit %2 != 0) { iMul = iMul * iDigit; } else { iMul = 1; } iNo = iNo/10; } return iMul; } int main() { ...
C
/* * @file list.c * */ #include <stdlib.h> #include "wge100_camera/list.h" #include "wge100_camera/host_netutil.h" /** * Initializes a new camera list using macros from list.h * * @param ipCamList Pointer to an IpCamList list element * * @return Always returns zero. */ int wge100CamListInit( IpCamList *ipCamL...
C
/* ============================================================================ Name : TP2_1_1.c Author : Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #include <stdio.h> #...
C
/// Динамическая память: malloc / free /// ---------------------------------- #include <stdio.h> #include <stdlib.h> int intStatic[100]; // Статическая память int main() { static int intStatic2[100]; // Статическая память int intStack[100]; // Стек //--> int stackArray[100]; // Массив в стеке int* intArray;...
C
#include <stdio.h> #include <stdlib.h> #include <malloc.h> #include<time.h> int intcomp(const void* x, const void* y){ int* xx = (int*)x; int* yy = (int*)y; return *xx - *yy; } //int floatcomp(const void* x, const void* y){ // float* xx = (float*)x; // float* yy = (float*)y; // // return *xx - *yy < 0? -1: *xx - ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <assert.h> #include <sys/time.h> #include <time.h> #define MAX_LEVELS 20 static int max_table; struct trans_thread { void **curr_table; int offset[MAX_LEVELS]; int curr; int max; }; int translate_cpu(struc...
C
/* * Simple program showing 2 threads with a mutex to access a shared counter variable. * IMPORTANT: Use the script "compile_with_pthreads" to build this example. gcc seems * picky about the order in whinc the input, output and libpthread arguments appear! * Enhanced to show two threads and two mutex varia...
C
#include <stdio.h> void classifyPoints(int x, int y) { if(x > 0 && y > 0) printf("primeiro\n"); else if(x < 0 && y > 0) printf("segundo\n"); else if(y < 0 && x < 0) printf("terceiro\n"); else if(x > 0 && y < 0) printf("quarto\n"); } int main(int argc, char const *argv[]) { int x, y; while(scanf("%d...
C
/* hash.h - Foundation library - Public Domain - 2013 Mattias Jansson * * This library provides a cross-platform foundation library in C11 providing basic support * data types and functions to write applications and games in a platform-independent fashion. * The latest source code is always available at * *...
C
#pragma once #define TEMPLATE_SPECIALIZATION template <\ typename _Object\ > #define CStateAbstract CState<_Object> TEMPLATE_SPECIALIZATION CStateAbstract::CState(_Object *obj, void *data) { reset (); object = obj; _data = data; } TEMPLATE_SPECIALIZATION CStateAbstract::~CState() { free_mem(); } TEMPLAT...
C
#include <getopt.h> #include <stdint.h> #include <stdlib.h> #include <stdio.h> #include "lb_config.h" #include "nf-util.h" #include "nf-log.h" #define PARSE_ERROR(format, ...) \ nf_config_usage(); \ fprintf(stderr, format, ##__VA_ARGS__); \ exit(EXIT_FAILURE); void nf_config_init(...
C
#include<stdio.h> int main() { FILE *fp; char f[25],e[25]; int i,j,fc,fo=0,fo_a[256],fe=0,fe_a[256],df_counter=0;; float ch_sq_a[256],ch_sq=0.0; printf("\nEnter the name of the source file(with extension) : "); scanf("%s",f); for(i=0;i<=255;i++) fe_a[i]=0; fp=fopen(f,"r+"); for(i=0;(fc=fgetc(fp))...
C
#include <stdlib.h> #include <stdio.h> #include <math.h> #include <float.h> #include <gsl/gsl_fit.h> #include <gsl/gsl_multifit.h> #include "jsd_fit.h" #include "nrfit.h" #include "nrutil.h" #define LOOP_COUNT_MAX 20 void jsd_minmax(double A[], int n, double *pmin, double *pmax) { int i; double min, max; if (n <=...
C
#include<stdio.h> #include<conio.h> int _strlen(char *p){ if(*p=='\0') return(0); else return(1+_strlen(p++)); } void main(){ char str1[100]; int len; clrscr(); printf("\nEnter a String:"); fflush(stdin); gets(str1); len=_strlen(str1); printf("\nLingth of the given string %s=%d",str1,len); getch(); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* libft.h :+: :+: :+: ...
C
// // Created by yyh on 18-7-30. // #include "client_fun.h" #include "mySocket.h" #include "login.h" #include "Initialization.h" /************************************************************************ 函数名称: void *client_fun(void *arg) 函数功能: 线程函数,处理客户信息 函数参数: 已连接套接字 函数返回: 无 *******************************************...
C
static inline bool mutexInit(pthread_mutex_t *mutex) { pthread_mutexattr_t mutexattr; return ASSERT((errno = pthread_mutexattr_init(&mutexattr)) == 0) || ASSERT((errno = pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_FAST_NP)) == 0) || ASSERT((errno = pthread_mutex_...
C
#include <stdio.h> #include <stdlib.h> int main() { double y ; for(y=1;y!=10;y++){ printf("%lf\n",y/10); } return 0; }
C
#include <stdio.h> #include <stdlib.h> void swap(int*, int, int); void imprimir_lista(int*, int); int main() { int i = 0; int j = 0; int n = 0; int* lista; printf("Cantidad de datos: "); scanf("%d", &n); lista = malloc(n*sizeof(int)); for(i = 0; i < n; i++){ scanf("%d", &lista[...
C
#include<stdio.h> #include<stdlib.h> struct node { int data; int status; struct node *next; }; struct node *root=NULL; void createGraph(struct node *adj[10],int n) { struct node *last; int m,val,d; for(int i=0; i<n; i++) { printf("Enter the neighbours for %d :",i); scanf("%d",&m)...
C
/*Atividade 2.5 - Consumo de combustvel*/ #include <stdio.h> #include <locale.h> int main() { system("cls"); setlocale(LC_ALL, "Portuguese"); float distancia, litros, consumo; printf("\n\n -------*Programa calcula o consumo mdio de combustvel*-------\n"); printf("\n Digite a distncia em quilmetros: "); ...
C
/* * PID.c * * Created on: Feb 27, 2015 * Author: Erik Johnson */ #include "derivative.h" #include "PID.h" #include "AK8963.h" #include "math.h" int Calculate_Error_Mag (AK8963_Data sensordata) // To be implemented**** (Erik) { // Compute current direction vector using the equation: // the...
C
/* Erich WOo & Boxian Wang * 26 October 2020 * Kernel Context Switching. See cswitch.h for detailed documentation */ #include "cswitch.h" // THE proc table extern proc_table_t *procs; // THE global kernel page tables extern kernel_global_pt_t kernel_pt; /********************* FUNCTION DECLARATIONS **************...
C
#include<stdio.h> //Reading input from user int read_int(void) { int i=0; char num[20]; scanf("%s",num); //Clear buffer while(getchar() != '\n'); //Check if the first character is integer or alphabet;if true return if(num[0]<48 || num[0]>57) { printf("The entered character is not integer.\n"); return 0...
C
/* * synchronized I/O */ #include <stdio.h> #include <fcntl.h> #include <sys/stat.h> char wbuf[] = {"12CDEFGHIJKLMNOP"}; int main() { int fd; int nw; int arg=0; unsigned int fl; fd = open("myfile.txt", O_RDONLY); printf("fd = %d\n", fd); fl=fcntl(fd, F_GETFL, arg); printf("fl = %x\n", fl); ...
C
/** *@file quectel_tts_client.c *@date 2017-08-24 *@author running.qian *@brief Quecte TTS client */ #include "ql_oe.h" #include "ql_tts_client_api.h" #define QL_TTS_LOG(format, ...) fprintf(stderr, "[QL_TTS_E][%d]:"format, __LINE__, ##__VA_ARGS__) void user_callback(ql_tts_client_event_e_ty...
C
#include <stdio.h> #include <string.h> // (1) string is a group of characters // how to store a string in char array? // size of char array must be >= num of characters + 1 // + 1 is for '\0' // (2) Arrays and pointers are different types that are used in similar manner // (3) Arrays are always passed to functio...
C
#include "vm_pool.H" #define MB * (0x1 << 20) #define KB * (0x1 << 10) #define KERNEL_POOL_START_FRAME ((2 MB) / FRAME_SIZE) #define KERNEL_POOL_SIZE ((2 MB) / FRAME_SIZE) #define PROCESS_POOL_START_FRAME ((4 MB) / FRAME_SIZE) #define PROCESS_POOL_SIZE ((28 MB) / FRAME_SIZE) /* definition of the kernel and process mem...
C
#include<stdio.h> #include<stdlib.h> #include<dlfcn.h> #include<string.h> #include <sys/types.h> #include <unistd.h> #include "handlers.h" char *so_array[300]; char filename[100]; char soname[100]; char so_name[300]; int init_handlers(){ static int i=0,j=1; FILE *fp; void *soptr; fp=fopen("./config.txt","r"); if...
C
#include <assert.h> #include <stdint.h> #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include "minimalloc.h" /* 4 is not enough for 64 bit arches */ #define MIN_ORDER 5 /* #define MAX_ORDER 24 */ #define CHUNKS_COUNT 5 /* * Chunked blob is split into contiguous...
C
// // GameInitializations.h // BlockBreaker // // Created by Shuyang Sun on 4/29/13. // Copyright (c) 2013 Shuyang Sun. All rights reserved. // #ifndef BlockBreaker_GameInitializations_h #define BlockBreaker_GameInitializations_h /** * Defining some game data, can be changed later. * The function "int areValidS...
C
// // Created by nicol on 29/09/2021. // #include "exercice.h" #include <stdio.h> #include "fonctions.h" void exercice1() { int a = saisissezEntier(); int b = saisissezEntier(); printf(getMax(a, b)); return; } void exercice3() { //int longueur = saisirLongueur(); //int largeur ...
C
/******************************************************************************* * * window_ncurses.c * * author: AC Pretorius * date : 01/04/2021 * *******************************************************************************/ #include <stdio.h> #include <string.h> #include <malloc.h> #include <ncurses.h>...
C
/* * ferror.c * * Copyright 1987, 1992 by Sierra Systems. All rights reserved. */ #include <stdio.h> /*---------------------------------- ferror() ------------------------------*/ /* * ferror tests the error indicator for the stream pointed to by fp. * ferror() returns non-zero if and only if the error indi...
C
/* gpio.c */ #include <stdint.h> #include "pico/stdlib.h" #include "tool.h" #include "driver_config.h" #include "gpio.h" void gpio_Init(void){ gpios_init(); } void gpios_init(void){ // Enable pins gpio_init(PICO_DEFAULT_I2C_SCL_PIN); gpio_init(PICO_DEFAULT_I2C_SDA_PIN); gpio_init(PIN_VEN); g...
C
#include <stdio.h> int xgets(char a[100]); int xputs(char a[100]); int main() { char s[100]; printf("\nEnter a String:\t "); xgets(s); xputs(s); printf("\n"); } int xgets(char a[100]) { scanf("%[^\n]s", a); } int xputs(char a[100]) { printf("%s", a); }
C
#include "../LinkedList/linkedList.h" #include "mediaDeTodosOsNumeros.h" #include <stdio.h> int main() { LinkedList *listaUlong = createLinkedList(sizeof(u_long)); for (size_t i = 0; i < 10; i++) appendLinkedList(listaUlong, &i); printf("%f\n", mediaDeTodosOsNumeros(listaUlong)); destroyLinkedList(listaUl...
C
#ifndef B3_AABB_H #define B3_AABB_H #include "Bullet3Common/shared/b3Float4.h" #include "Bullet3Common/shared/b3Mat3x3.h" typedef struct b3Aabb b3Aabb_t; struct b3Aabb { union { float m_min[4]; b3Float4 m_minVec; int m_minIndices[4]; }; union { float m_max[4]; b3Float4 m_maxVec; int m_signedMaxInd...
C
#ifndef __VECTOR_2F_H__ #define __VECTOR_2F_H__ #include <math.h> struct Vec2f { float x; float y; Vec2f() : x(0.0f), y(0.0f) {;} Vec2f(float x, float y) { this->x = x; this->y = y; } Vec2f(const Vec2f& vec) { this->x = vec.x; this->y = vec.y; } Vec2f(float size) { this->x = size; this-...
C
int printf(const char *s, ...); int main() { int foo; foo = 3; int bar; bar = 7; printf("foo - bar = %d, foo = %d, bar = %d\n", foo - bar, foo, bar); return 0; }
C
// // Created by helisi on 2021/7/31. // #include <stdio.h> /** * this program calculate summary from 0 to 9 * @param argc parameter count * @param argv parameters * @return 0 * */ int main(int argc, char **argv) { int sum = 0; int i = 0; for (; i < 10; ++i) { sum = sum + i; } printf("%d\n", ...
C
#include "holberton.h" /** * _puts - returns the length of a string. * @s : pointer to char * Return: void * On error, -1 is returned, and errno is set appropriately. */ void _puts(char *s) { int k = 0; while (*(s + k) != '\0') { _putchar(*(s + k)); k++; } _putchar('\n'); }
C
#pragma once #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <math.h> #include "LRU/K_hash.h" /** * A list. */ struct List { int page; /**< a page of data */ struct node *value; /**< an adress of data. */ struct List *next; /**<...
C
#include <stdio.h> int main(void){ int i,j,k,n; double a[100][100]={0},m; printf("n="); scanf("%d",&n); for(i=0;i<n;i++){ for(j=0;j<n;j++){ printf("(%d)X%d=",i+1,j+1); scanf("%lf",&a[i][j]); } } for(i=0;i<n;i++) a[i][n+i]=1; for(i=0;i<n-1;i++){ for(j=i+1;j<n;j++){ m=a[j][i]/a[i][i]; for(k=i;k<n*2;k++) a[j][k]-=m*a...
C
#include<stdio.h> #include<string.h> int main() { char ch; while(ch!=EOF) { ch=getchar(); if(ch=='W') printf("Q"); else if(ch=='E') printf("W"); else if(ch=='R') printf("E"); else if(ch=='T') printf("R")...
C
#include<stdio.h> #include <stdlib.h> typedef int ElemType; //еĴ洢 typedef struct QNode// н { ElemType data; struct QNode *next; } QNode; typedef struct // { QNode *front; // ͷָ QNode *rear; // βָ } LinkQueue; //նӣɹ1ʧܣ0 int InitQueue(LinkQueue *Q) { Q->front = Q->rear =(QNode *)mallo...
C
/**************************************/ /* */ /* Code from the book C Unleashed */ /* Macmillan, 2000 */ /* Chapter 6: Data Files */ /* Steve Summit 2000-03-17 */ /* */ /********************************...
C
#include <sys/types.h> #include <sys/socket.h> #include <stdio.h> #include <sys/un.h> #include <unistd.h> #include <stdlib.h> #include <errno.h> void print_error(const char* s) { printf("%s, errno: %d, message: %s.\n", s, errno, sys_errlist[errno]); } void confirm_continue() { printf("Press any key to continu...
C
<!DOCTYPE html> <title>Canvas test: 2d.composite.uncovered.pattern.destination-atop</title> <script src="../tests.js"></script> <link rel="stylesheet" href="../tests.css"> <body> <p id="passtext">Pass</p> <p id="failtext">Fail</p> <p class="output">These images should be identical:</p> <canvas id="c" class="output" wid...
C
#define FIXED_DIM 10 #include <stdio.h> #include <stdlib.h> #include "item.h" #include "stack.h" struct stack { Item arr[FIXED_DIM]; int riemp; }; Stack newStack() { Stack stack = malloc(sizeof(struct stack)); stack->riemp = 0; return stack; } int isEmptyStack(Stack stack) { retu...
C
#include <systemd/sd-daemon.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> int create_xml(const char* device, const char* filename); int attach_device(const char* device, const char* vm); int detach_device(const char* device, const char* vm); //create XML for "vir...
C
#include <uproc.h> #include <stdint.h> #include <float.h> #include <limits.h> #include <string.h> #include <errno.h> #include <stdio.h> static int __uchar_read_proc(uproc_buf_t *buf, int *done, off_t fileoff, void *private_data) { unsigned char *v = (unsigned char *)private_data; int n = snprintf(buf->mem, bu...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { srand(time(NULL)); /* With this we make the random number different each time we execute the program */ char PossibleColors[][16] = { "blue", "green", "red", "yellow", "white", "black" }; int RandomColor = rand...
C
/* DESCRIPCIÓN: Programa que evalúa y valida una expresión infija COMPILACIÓN: Crear objeto gcc TADpila[D].c -c Ejecucion dinamica gcc TADpila[D].c Parentesis.c -o Par */ //LIBRERIAS #include <stdio.h> #include <stdlib.h> #include <math.h> #include "TADpila[D].h" //Libreria que contiene TAD Pila Dinamica //PROG...
C
#include <stdio.h> #include <stdlib.h> typedef struct AdjListNode{ int dest; struct AdjListNode* next; }AdjListNode; typedef struct AdjList { struct AdjListNode* head; }AdjList; typedef struct Graph { int V; struct AdjList* array; int type; }Graph; Graph* createGraph(int V, int type) { Graph *graph = malloc...
C
#include<stdio.h> #define SIZE 2 void MM(int A[SIZE][SIZE],int B[SIZE][SIZE],int C[SIZE][SIZE],int n) { int P,Q,R,S,T,U,V; // if(n<=2) // { P=(A[0][0]+A[1][1])*(B[0][0]+B[1][1]); Q=(A[1][0]+A[1][1])*B[0][0]; R=A[0][0]*(B[0][1]-B[1][1]); S=(A[1][1])*(B[1][0]-B[0][0]); T=(A[0][0]+A[0][1])*B[1][1]; U=(A[1][0]-A[0][0])*(...
C
//άԪڴеĴ洢λ //ά1010,±0ʼ #include "stdio.h" main() { int loc_a00;//Ԫռڴһά׵ַ int num;//ÿԪռõĴ洢Ԫ int loc_aij; int i,j; printf("Ԫռڴһά׵ַ:"); scanf("%d",&loc_a00); printf("ÿԪռõĴ洢Ԫ:"); scanf("%d",&num); printf("άкźк:"); scanf("%d,%d",&i,&j); loc_aij=loc_a00+(i*10+j)*num;// printf("ȶάa%d%dڴеַΪ:%d\n",i,j,loc...
C
#include <stdio.h> int main(void) { int i, j, n, a, b, sum = 1; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d", &a, &b); for (j = 0; j < b; j++) { sum *= a; while (sum - 10 > 0) sum %= 10; } if (sum == 0) printf("%d\n", 10); else ...