language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* * hal_flash.c * * Created on: Nov 8, 2019 * Author: caijie */ #include "hal_flash.h" #ifdef HAL_FLASH #ifdef STM32F4 #if (BOARD_FLASH_SIZE == 512) #define STM32_FLASH_NPAGES 8 static const uint32_t flash_memmap[STM32_FLASH_NPAGES] = { KB(16), KB(16), KB(16), KB(16), KB(64),...
C
#define BOUND 7 int kappa; int input,output; #include <assert.h> #include <math.h> #include <stdlib.h> int inputs[] = {2,5,3,1,4}; int calculate_output(int); int calculate_outputm1(int); int calculate_outputm2(int); int calculate_outputm3(int); int calculate_outputm4(int); int calculate_outputm5(int)...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <windows.h> void Check(int arr[], int len){ int i = 0; int tmp = 0; int k = 0; int s = 0; //ֻһֵĽtmp for (i = 0; i < len; i++){ tmp = tmp^arr[i]; } //ҳĵһΪ1λcount int count = 0; for (i =31; i >= 0; i--){ if((tmp >> i) &1){ count = i; } } /...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* freeanderrors.c :+: :+: :+: ...
C
#include <stdio.h> #define BR_ELEMENTI 100 void pecati_niza(int *a, int m); void zameni(int *a, int *b); void modificiraj(int a[], int m); int main() { int a[BR_ELEMENTI], i, m; printf("Vnesete broj na elementi M:"); scanf("%d", &m); printf("\nVnesete ja nizata:\n"); for (i=0;i<m;i++) { printf("a[%d]=", i); scanf("%...
C
#include <stdio.h> #include <time.h> #define N 1E7 #define d 1E-7 #define d2 1E-14 int main (int argc, char* argv[]) { clock_t begin = clock(), end; double pi=0.0, result=0.0,x2=0.0; int i=0; for (i=0; i<N; i+=1) { x2=d2*i*i; result+=1.0/(1.0+x2); } pi=4*d*result; end = cloc...
C
#include <stdio.h> struct point { int x; int y; }; struct rect { struct point pt1; struct point pt2; }; struct point makepoint(int x, int y) { struct point temp; temp.x = x; temp.y = y; return temp; } struct point addpoint(struct point p1, struct point p2) { p1.x += p2.x; p1.y += p2.y; return p1; } mai...
C
#include <stdlib.h> #include <stdio.h> /* struct Person { int code; char name[255]; int age; char address[255]; };*/ struct Person { int code; char *name; // 8 b int age; char *address; // 8 b }; struct Person *funcao() { // ... } int main(int argc, char *argv[]) { // 1.a declaracao struct Person p; // s...
C
#include <stdio.h> #include <math.h> double sqrt_iter(int n){ int i; double s; if(n % 2 == 0) n--; s = 0; for(i = n; i >= 1; i -= 2){ s = sqrt(s + i); } return s; } double sqrt_rek(int i, int n){ if(n % 2 == 0) n--; if(n == i) return sqrt(i); return sqrt(i + sqrt_rek(i ...
C
#include "lpc17xx.h" #include "led.h" #include <math.h> /* Ex1 */ void led4and11_On(void) { LPC_GPIO2->FIOSET |= 0x00000081; }; /* Ex 2 */ void voidled4_Off(void) { LPC_GPIO2->FIOCLR |= 0x00000080; }; /* Ex 3 */ void ledEvenOn_OddOf(void) { /* * In order to avoid modifications on other PINs, we use F...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #define BLOCK_SIZE 512 typedef uint8_t BYTE; int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage: ./recover image\n"); return 1; } FILE *inptr = fopen(argv[1], "r"); if (inptr == NULL) { fpri...
C
#include<stdio.h> #include<string.h> int main() { int i,T,j; char s[1001]; scanf("%d",&T); while(T--) { scanf(" %[^\n]",s); int count[26]={0}; for(j=0; j<strlen(s); j++) { if(s[j]>='A' && s[j]<='Z') { count[s[j]-'A']++; } } ...
C
//#include <stdio.h> // //int main() //{ // long long bitmask = 0; // int input; // int num_diff_r = 0; // for (int i = 0; i < 10; ++i) // { // scanf("%d", &input); // if ((bitmask & (long long)1 << (input % 42)) == 0) // { // bitmask |= (long long)1 << (input % 42); // num_diff_r++; // } // } // // printf("%d\...
C
#include "ElemSN.h" void InversePrint(ElemSN *h) { ElemSN *p = NULL, *pend = NULL; while(pend - h) { for ( p = h; p->next - pend; p = p->next); printf("%d\t", p->data); pend = p; } } int main() { ElemSN *head = NULL; head = CreateLink1(a); PrintLink(head); Inv...
C
#include "game.h" /** * @file game.c * @brief The main of the game * @author Aymen Benabderrahmane * @version 1.0 * @date 6 janvier 2020 */ int main(){ int player = 0; struct matrix_t mat; /* Matrix allocation */ mat = alloc(6, 7); init_matrix(&mat); printf("===== Bienve...
C
#include <stdio.h> #include <string.h> // Given two strings, determine if the first is a permutation of the second int str_is_permutation(char *first_str, char *second_str) { if (strlen(first_str) != strlen(second_str)) { printf("Not a permutation"); return 1; }; int ascii[255] = { 0 }; // Set...
C
void Del_x(LinkList L,int x){ LNode *p; //p指向待删除结点 if(L==NULL) //递归出口 return ; if(L->data==x){ //若L所指的结点的值为x p=L; //删除*L,并让L指向下一个结点。 p=L->next; free(p); Del_x(L,x); //递归调用 } else ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* semicolon.c :+: :+: :+: ...
C
/* * ======================================================================================= * * Filename: ip.c * Description: IP handling * Compiler: gcc * Author: Simon L. J. Robin | https://sljrobin.org * Created: 2015-04-30 15:28:41 * Modified: 2016-02-13 13:40:59 * * =...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* minimap.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> int main(void){ float numero_1, numero_2; printf("Digite dois numeros para ser feita a analise deles.\nN1: "); scanf("%f", &numero_1); printf("N2: "); scanf("%f", &numero_2); if (numero_1 == numero_2){ puts("Os dois numeros sao iguas!"); }els...
C
#include<stdio.h> int main() { int j,i,lw,up,temp,a,arm=0; scanf("%d",&lw); scanf("%d",&up); for(j=lw;j<up;j++) { temp=j; for(i=0;temp!=0;i++) { a=temp%10; arm=arm+(a*a*a); temp=temp/10; } if(j==arm) printf("\n%d",arm); arm=0; return0 ; }
C
// // main.c // Prog11 // // Created by Fallingstar on 2017. 3. 21.. // Copyright © 2017년 Fallingstar. All rights reserved. // #include <stdio.h> #include <GLUT/glut.h> #include <math.h> #define SC_FACT 3 void init(); void display(); void rotate(GLfloat *v, GLfloat angle); void translate(GLfloat *v, GLfloat *t);...
C
#include<stdio.h> #include<stdlib.h> typedef struct polynode{ int coef; int expon; }pNode; typedef struct polynomial{ pNode *poly; int size; }Polynomial; Polynomial* readPoly(){ int N,e,c; Polynomial *p; scanf("%d",&N); printf("%d\n",N); p=(Polynomial*)malloc(sizeof(Polynomial)); p->size=N; ...
C
//LAB4 Task2 Part1 //Chase Austin Deitner //ECE 474 SP2020 //Replecates a traffic light with a pedestrian cross signal // uses external LCD touch screen. User must hold buttons // for at least 2 seconds for the system to register //Initializes LCD Screen to support all traffic light funtions #inclu...
C
#ifndef READLINE_H #define READLINE_H #include <stddef.h> // readline reads a single line of input. If more than one line is read, the // pointer arguments provide enough state to restart the next line in the // buffer. buf is automatically resized to fit the line. // // buf is a pointer to a char buffer. If this is ...
C
#include "libft.h" char *ft_strdup(const char *s) { char *ptr; int i; if (!(ptr = (char *)malloc(ft_strlen((char *)s) + 1))) return (NULL); i = 0; while (*s) { *ptr++ = *s++; i++; } *ptr = '\0'; return (ptr - i); }
C
/* GPIO ports 1. 18 outputs (LED) a. set1(PB0-PB7, PA4) b. set2(PD2-PD3, PD6-PD7, PC5-PC7, PE0,PE3) 2. 3 inputs (Buttons) (PF0,PF4,PE5) 3. 2 inputs (ADC) (PE1-PE2) 4. 2 outputs (PWM) (PC4,PE4) */ /* Definitions for the Tic Tac Toe game functions. */ /*** Winning Score for Player:9 Winning ...
C
#include<stdio.h> void main() { int n,f=1,x; printf("enter a number"); scanf("%d",&n); x=n; while(n>=1) { f=f*n; n--; } printf("factorial of %d is%d",x,f); }
C
#include<stdio.h> #include<stdlib.h> #include<pthread.h> #include<math.h> #include "timer.h" double sequential_pi(int number_of_steps){ double pi = 0; for(int i; i<number_of_steps; i++){ if(i%2 == 0) pi += 1.0/(2.0*i+1.0); else pi -= 1.0/(2.0*i+1.0); } return 4*pi; } int main(int arg...
C
/* -*- c -*- */ /* * Arduino Tunes with piezo buzzer and PWM. * * Connect the positive side of the buzzer to pin 3, then the negative * side to a 300 Ohm resistor. * Connect the other side of the resistor to ground (GND) pin * on the Arduino. * * Based on the code by Dipto Pratyaksa. * Rewritten by Valery V. V...
C
struct LCA { vector<vector<int>> adj; vector<vector<int>> p; vector<int> h; // h[1] = 1 int n, logn = 0, root = 1; LCA(int n): n(n) { while ((1 << logn) <= n) logn++; adj.resize(n + 1); p = vector<vector<int>>(n + 1, vector<int>(logn + 1)); h.resize(n + 1); } ...
C
/* ** teams_tools.c for team tools in /home/mille_j/Documents/zappy/serveur/src/cmd_line ** ** Made by john mille ** Login <mille_j@epitech.net> ** ** Started on Wed Jun 15 09:01:04 2011 john mille ** Last update Fri Jul 8 23:37:51 2011 john mille */ #include <stdlib.h> #include <stdio.h> #include "zappy.h" #inclu...
C
// // Created by ayumu on 2020/06/12. // #include "model/token.h" #include "lexer.h" #include "../utility/string_util.h" #include <ctype.h> #include <string.h> #include <stdlib.h> #include <stdbool.h> #include <stdio.h> Either(char*) consume_operator_lexer(char *str); unsigned issignal(char ch); unsigned isequal(ch...
C
#include <stdio.h> #define MAXLINE 1000 int main() { char *line = NULL; char finalline[MAXLINE]; size_t linecap = 0; ssize_t linelen; int i, j,fi; char c; // read the line while ((linelen = getline(&line, &linecap, stdin)) > 0 ) { fi = 0; for (i=0; (i < linelen) && (lin...
C
//LCD-keybard //enter more than 4 digits --> 4 stars //enter admin password --> flashing LED sbit LCD_RS at RB4_bit; //or PORTB.RB4 sbit LCD_EN at RB5_bit; sbit LCD_D4 at RB0_bit; sbit LCD_D5 at RB1_bit; sbit LCD_D6 at RB2_bit; sbit LCD_D7 at RB3_bit; sbit LCD_RS_Direction at TRISB4_bit; sbit LCD_EN_Di...
C
#include <stdlib.h> #include <stdio.h> int *funk (int *tab1,int *tab2, int *tab3, int n) { int i; int *tab4=malloc(n*sizeof(int*)); for (i=0;i<n;i++) { if (*tab1>=0) *(tab4+i)=*(tab2+i); else *(tab4+i)=*(tab3+i); } return tab4; } int main () { int a[4]={-1,-2,3,4},b[4]={1,3,5,7},c[4]={2,4,6,8},i; int *tab...
C
#include<stdio.h> void main(int h) { int i=0; do { h=0; printf("Height:"); i=scanf("%d",&h); char c; while((c = getchar()) != '\n' && c != EOF); //printf("h:%d\n",h); } while( i==0 || h<=0 || h>23); // printf("%d",h); if(h>0 && h<24) { for(int i=0;i<h;i++) { for(int j=0;j<h;j++) { ...
C
#include<stdio.h> #include<stdlib.h> #include<sys/socket.h> #include<sys/types.h> #include<netinet/in.h> #include<string.h> #include<unistd.h> #include<sys/time.h> #include<errno.h> typedef struct{ int listenSd, connectSd; struct sockaddr_in srvAddr, clntAddr; int clntAddrLen, readLen, strLen; char rBuff[BUFSIZ]; ...
C
#include "CHINESE.H" FILE *hzk_p; char mat0[32],mat1[72],mat2[128],mat3[288]; void chinese(int x,int y,char *s,int color,int type,char ziti)//x,y 输出位置 字符组 颜色 大小 字体 { int a=x; switch(type) { case 16: switch(ziti) { case 'F': open_hzk("hzk\\HZK16F"); break; case 'H': ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> // Find the largest palindrome made from the product of two 3-digit numbers. #define BUFFER_LEN 8 int is_palindrome(int p) { char pstr[BUFFER_LEN]; snprintf(pstr, BUFFER_LEN, "%d", p); int plen = strlen(pstr); for(int i = 0; i < plen/2; i++) ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> struct Employee* create_node(struct Employee* ); struct Employee* insert(struct Employee* , struct Employee *); struct Employee* delnode(struct Employee*,char *); struct Employee *search(struct Employee * , char *, struct Employee ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* builtin_unalias.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstnew.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> int n; int partition(int arr[n],int l,int h) { int pivot,i,j,temp; pivot=arr[h]; i=l-1; for(j=l;j<n;j++) { if(pivot>arr[j]) { i++; temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; } } tem...
C
/* Author: Marcus Ross * MR867434 */ #include <stdlib.h> #include "list.h" #include "const.h" /* This function's arguments are a pointer to a hash table of struct opcodeNodes of size specified by the constant OPCODE_HASH_SIZE. It populates the hash table with instructions specified contained in the array sp...
C
/* This function converts the last pushed variable, which is assumed to hold a string, to a list of one element. The string variable is discarded after use. The formed list, containing one element, is copied onto the stack to the former position of the string variable. */ #include "opcodefun.ih" void ...
C
/********************************************************************** * This code is representing my tests of Hashtable * * Lab: OL-79 * * Author: Yonatan Vologdin * * Reviewer: Dvir Breitbart * * Date: 28.12.19 ...
C
/* ============================================================================ Name : OpPhone.c Author : leen Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #include <stdio...
C
#include "DHT11.h" #include "delay.h" #include "stdio.h" void DHT11_output(){ GPIO_InitTypeDef settings; settings.GPIO_Mode=GPIO_Mode_Out_PP; settings.GPIO_Pin=DHT11_PIN_DATA; settings.GPIO_Speed=GPIO_Speed_50MHz; GPIO_Init(GPIOA,&settings); } void DHT11_input(){ GPIO_InitTypeDef settings; settings.GPIO_Mode=GPI...
C
Daniel Bonnin CS362 Fall 2015 bonnind@oregonstate.edu BugsInTeammates.c This file contains documentation of the bugs I found during testing of teammates` code for Assignment 5. Teammate 1 (Victor Hernandez): Name: adventurerCard() causes segFault when deck is empty. File: dominion...
C
#include <stdio.h> #include <stdlib.h> #include "../../color.h" void show_infos(color_t* c) { printf("c = "); color_print_rgb(c); printf("\n" "c = "); color_print_hsv(c); printf("\n" "alpha = %d\n\n", color_alpha(c)); } int main(int argc, char* argv[]) { int opt = 0; ...
C
#include <stdio.h> #include <stdlib.h> typedef struct EDGE { int u,v; int w; }EDGE; void Sort(EDGE arr[], int n) { int i, j; EDGE tmp; for (i = 0; i < n-1; i++) // Last i elements are already in place for (j = 0; j < n-i-1; j++) if (arr[j].w > arr[j+1...
C
#include <stdio.h> /* (POLI 87) Dados n e uma seqncia de n nmeros inteiros, determinar quantos segmentos de nmeros iguais consecutivos compem essa seqncia. Exemplo: A seguinte seqncia formada por 5 segmentos de nmeros iguais: 5, 2, 2, 3, 4, 4, 4, 4, 1, 1 */ int main() { int seq, cont, seqq, i...
C
#ifndef MISC_H #define MISC_H typedef struct { LOCK_T lock; void *list_ptr ; int count; }dlist_t; typedef struct { void *next; void *prev; }dlist_element_t; #define DLIST_RESET(dlist) { dlist->list_ptr=dlist->count=0; } #define DLIST_APPEND(dlist,node) \ { \ if(list_ptr==0) { \ list_ptr=node; \ else { \ ...
C
#include "../my_util.h" /* values, weights arr[] = {{60, 10}, {100, 20}, {120, 30}} 6, 5, 4 Knapsack Capacity, W = 50; */ double fractional_knapsack(const vector<int>& values, const vector<int>& weights, int W) { struct Item { int value = 0; int weight = 0; }; vector<Item> i...
C
#include <stdio.h> #include <stdlib.h> int main(void) { printf("%d\n", 31); printf("%o\n", 0x19); printf("%x\n", 49); return EXIT_SUCCESS; }
C
#include<stdio.h> #include<windows.h> #include<stdlib.h> #include<search.h> #pragma warning (disable:4996) //void printf_arr1(int arr[3][5],int row,int col) //{ // int i = 0; // for(i = 0; i < row; i++){ // int j = 0; // for(j = 0; j < col; j++){ // printf("%d",arr[i][j]); // } // printf("\n"); // } //} //void ...
C
/* Program to search an element in the array using Binary search Technique Example: Enter array size:5 Enter elements:4 8 2 6 1 Enter number to search:6 6 is found at location 4*/ #include<stdio.h> void search(int,int); int arr[20]; void main() { int n,i,j,a,temp; printf("Enter array size:"); ...
C
/** * pthread_mutex_timedlock函数实例 * *当线程试图获取一个已经加锁的互斥量时,pthread_mutex_timedlock允许指定线程的阻塞时间, *达到超时时间时,pthread_mutex_timedlock返回错误码ETIMEDOUT */ #include "apue.h" #include <pthread.h> #include <time.h> int main(void) { int err; struct timespec tout; struct tm *tmp; char buf[64]; pthread_mutex_t lo...
C
/* Description: The ANSI C code of the PRVNS approach Programmer: Wesklei Migliorini E-mail: wesklei.m@gmail.com Date: 04/11/2014 Lisence: Free Note: The system was developed using Linux. To compile: Type: make To run: ./algorithm input.in */ #include "functions.h" void prepararObjFunc(int* FU...
C
#include "alloc.h" #include "error.h" #include <stdlib.h> #include <stdio.h> #include <SDL2/SDL.h> void sn_abort(const char *reason) { // TODO: // 1: should not be allocating memory in an error handler // 2: should not be blindly using a 1024 character buffer for the error message // 3: should not be ...
C
/* * NXHelp - demo.c * by Lance Lovette * Code and display copyright 1992, by Lance Lovette. * All Rights Reserved * * This code demonstrates the creation of a help menu * on the menu bar using the help facility described in the README. */ #include <Xm/Xm.h> #include <Xm/Label.h> #include <Xm/Form.h> #include...
C
/*Excersie 8 Program 2 AUMRUDH LAL KUMAR TJ*/ //Program To Print emplyee details #include<stdio.h> struct employee { int eid; char name[20]; char dep[20]; float bpay; float da; float hra; float gpay; float npay; float pf; }em[50]; main() { int n,i; printf("Enter the number of employee\n"); sc...
C
/* * Find the Difference * * Given two strings s and t which consist of only lowercase letters. * * String t is generated by random shuffling string s and then add one more letter * at a random position. * * Find the letter that was added in t. * * Example: * Input: s = "abcd", t = "abcde" * Output: e ...
C
// POS47-C: Noncompliant Code Example volatile int a = 5; volatile int b = 10; /* Lock to enable threads to access a and b safely */ pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER; void* worker_thread(void* dummy) { int i; int c; int result; if ((result = pthread_setcanceltype(PTHREAD_CANCEL_ASYN...
C
#include <stdio.h> #include <stdlib.h> #include "pila.h" ///6. Pasar el primer elemento (tope) ///de la pila DADA a su ltima posicin (base), dejando los restantes elementos en el mismo orden. int main() { Pila DADA; Pila AUX; int numero; inicpila(&AUX); inicpila(&DADA); char segu...
C
/* * jying FastCGI Process Manager * * Copyright (C) 2020 * * Website: https://www.cnblogs.com/jying * * 2020/12/06 Created. * * Description: This file mainly includes the functions about * */ #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0500 #endif //_WIN32_WINNT #include <windows.h> #include <wins...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int main (int argc, char* argv[]) { float a, b, c, delta, raiz_unica, raiz_dist1, raiz_dist2, raiz_quad; printf("Digite os coeficientes da equaçao do segundo grau: "); scanf("%f %f %f", &a, &b, &c); delta = b * b - 4 * a * c; if (delt...
C
/* * 24C256 und 24C512 sind beide kompatibel bezüglich Adressierung * * Achtung!!!! Wenn auf EEPROM geschrieben und gleich wieder gelesen * wird, kann es zu fehlerhaften Ausgaben kommen. Unbedingt ein paar * Milisekunden Delay einbauen bevor zurückgelesen wird... * * EEWrite_8(1, 1, 123); * _delay_ms(50...
C
int minDistance(int src[][],int x_low,int x_high) { if (x_low == x_high) return distance(src[x_low) } int main() { int src[][2] = {(1,3),(2,4),(5,7),(3,9),(6,8)}; }
C
#include <stdio.h> #define TAMVECTOR 12 void main() { // ESTA ES LA FORMA DE DECLARAR E INICIALIZAR UN VECTOR //float vectorTemp[12] = { 3.5, 5.8, 10.5, 13.8, 15.0, 20, 25, 30, 22, 18, 15, 5.0}; float vectorTemp[TAMVECTOR]; float media = 0; int i; for (i = 0; i < TAMVECTOR; i++) { printf("Introdu...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sorting_hat.c :+: :+: :+: ...
C
#include <stdlib.h> #include <stddef.h> #include <stdio.h> #include "xalloc.h" void * xmalloc(size_t size) { void *p; p = malloc(size); if (p == NULL) { perror("xmalloc"); exit(EXIT_FAILURE); } return p; } void xfree(void *ptr) { free(ptr); }
C
#include <stdio.h> int main() { float i,j; for(i=0.0;i<2.02;i=i+0.2){ for(j=1.0;j<=3.0;j++){ printf("I=%g J=%g\n",i,j+i); } } }
C
/*numPass=6, numTotal=6 Verdict:ACCEPTED, Visibility:1, Input:"1 0 0 1", ExpOutput:"(1.000,1.000) ", Output:"(1.000,1.000)" Verdict:ACCEPTED, Visibility:1, Input:"1 0 1 0", ExpOutput:"INF ", Output:"INF" Verdict:ACCEPTED, Visibility:1, Input:"-1.25 0 5 4", ExpOutput:"(-0.800,1.250) ", Output:"(-0.800,1.250)" Verdict:AC...
C
#include<stdio.h> void main(){ float x; scanf("%f",&x); if ((x - (int)x) >= 0.5) printf("%d",(int)x+1); else printf("%d",(int)x); }
C
#include <stdlib.h> #include <stdio.h> #include "xxhash.h" #include "ida_search_core.h" #include "ida_search_444.h" unsigned int centers_444[NUM_CENTERS_444] = { 6, 7, 10, 11, 22, 23, 26, 27, 38, 39, 42, 43, 54, 55, 58, 59, 70, 71, 74, 75, 86, 87, 90, 91 }; struct wings_for_edges_recolor_pat...
C
#include "libmx.h" int mx_memcmp(const void *s1, const void *s2, size_t n) { char *c1 = (char*) s1; char *c2 = (char*) s2; size_t i; for (i = 0; i < n; i++) { if (*c1 - *c2 != 0) return *c1 - *c2; c1++; c2++; } return 0; } /*#include <stdio.h> int main() { ...
C
/* * M41T0M6F.h * * Created on: July 22, 2020 * Author: LongHD */ /******************************************************************************/ /******************************************************************************/ /* INCLUDE FILES */...
C
/*Etapa 4 - Piscar o Leds D1 em PF9 com o SysTick e um contador */ #include "stm32f4xx.h" void Systick_Wait(uint32_t delay){ SysTick->LOAD = delay - 1; SysTick->VAL = 0; while((SysTick->CTRL & 0x00010000) == 0) { //aguarda at zerar o contador do SysTick } } /* Funo que cria delay em X *1ms */ void My_delay(uin...
C
#include <string.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <errno.h> #include "utils.h" #define BUFFER_HEAD_LEN 20 extern MYSQL *mysql; int timestamp = -1; int getCurrentTimestamp() { time_t t; return time(&t); } int query_alerts_and_send() { MYSQL_RES *res_ptr; MYSQL_ROW mysql...
C
#include<stdio.h> int main() { char number[105]; printf("Enter the number\n"); scanf("%s",number); int i=0; int a=0,b=0; while(number[i]!='\0') { if(number[i]=='.') { a++; if(number[i+1]!='\0') b=1; } i++; ...
C
#include "proxy.h" char* communicate(int requestType, char* host, int robot_number, char* robot_id, int data){ int sock; /* Socket descriptor */ struct sockaddr_in echoServAddr; /* Echo server address */ int port = -1; /* Echo server port */ char filename[30]; /* ...
C
#ifndef CAR_H #define CAR_H #include <raylib.h> #include "track.h" enum car_controls_e { CONTROL_UP, CONTROL_LEFT, CONTROL_RIGHT }; typedef struct car_t { Model model; Color color; Vector3 acceleration; float angle; Quaternion direction; particle_t particle_head; particle_t pa...
C
int main() { int m1,n1; cin >> m1 >> n1; int m=m1,n=n1; int a[m]; int b[n]; int i,j,k; for(i=0;i<m;i++) { cin>> a[i]; } for(i=0;i<n;i++) { cin >> b[i]; } for(i=0;i<m-1;i++) { for(j=0;j<m-1-i;j++) { if(a[j]>a[j+1]) { k=a[j];a[j]=a[j+...
C
#include <stdio.h> int main () { int x, y, i, s = 1; float m; printf("Enter x & y: "); scanf("%d %d", &x, &y); for(i = 1; i <= y; i++) { s = s*x; } m = 1.00/s; printf("%f", m); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* philo_nodbin_functions.c :+: :+: :+: ...
C
#ifndef _XNB_LZ4MG_H_ #define _XNB_LZ4MG_H_ #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> /* Decompresses LZ4 from MonoGame. The original C lib has a lot of modes and configs, but * MonoGame only uses the core 'block' part, which is a fairly simple LZ77 (has one command * to copy li...
C
/*************************************************************/ /** * @file MyApplication.c * @brief Default file for creating custom applications based on the default project * @author Timo Bayer * * @date 25.05.2016 * @version 1.0 *************************************************************/ #include <st...
C
/* ** EPITECH PROJECT, 2020 ** PSU_minishell2_2019 ** File description: ** setenv */ #include <my_tools.h> #include <minishell.h> int my_setenv(char **cmd, data_t *data) { if (my_setenv_error_case(cmd, true) == -1) return 84; if (my_strlentab(cmd) == 1) print_dlist_begin(data->list); if (my_strlentab(cmd)...
C
#include <string.h> #include <assert.h> #include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <stdarg.h> struct List_T { void * val; struct List_T * next; }; extern struct List_T * List_init(void); extern struct List_T * List_push(struct List_T * list, void * val); extern int List_length(struct ...
C
/* pow() - program to print square, cube and fourth power of a given number without doing any unnecessary calculations */ #include <stdio.h> #include <conio.h> #include <math.h> void main() { float x; clrscr(); printf("Enter a number: "); scanf("%f", &x); printf("Square = %f \n", pow(x, 2)); printf("Cube = %f \...
C
// ConsoleApplication50.cpp : ļ "main" ִнڴ˴ʼ // #include <iostream> #pragma warning(disable:4996) using namespace std; template<class T> struct BSTNode { BSTNode(const T& data = T()) :_data(data), _Left(nullptr), _Right(nullptr) { } public: struct BSTNode<T>* _Left; struct BSTNode<T>* _Right; T ...
C
#include<stdio.h> int main() { int arr[] ={1, 2,43}; printf("%p\n" , arr + 1 * sizeof()); printf("%") }
C
#include <stdio.h> #include <time.h> main(){ int x, i; time_t start, end; int reps = 1000; unsigned int size = reps * 1000; start = time(NULL); printf("\n"); for (i = 0; i < size; i++){ x = (rand() % 100)%2; printf("%d ", x); if (i % 80 == 0) printf("\n"); } printf("\n"); end = ti...
C
#include "semantic.h" #include "hashTable.h" #include <string.h> int structFlag; int funcParamFlag; void Program(Node* root){ if(!root) return; hashInit(); structFlag = funcParamFlag = 0; ExtDefList(root->child); //for 2.1 for(int i = 0;i < HASH_SIZE;i++){ if(hashtable[i]){ ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> #include "bitrank/bitrankw32int.h" #include "bitrank/bit_array.h" #define num_threads __cilkrts_get_nworkers() #define FACTOR 20 // bitmap usage typedef unsigned int symbol; symbol* read_text_from_file(const char* fn, unsigned long* n) { ...
C
#ifndef __ARPOISON__DEBUG #define __ARPOISON__DEBUG #include "ip_address.h" #include "mac_address.h" inline void print(MACAddress address){ for(int i = 0; i < MAC_ADDRESS_LEN - 1; ++i){ printf("%.2X:", address.octets[i]); } printf("%.2X\n", address.octets[MAC_ADDRESS_LEN - 1]); } inline void pr...
C
/* bench.c Rémi Attab (remi.attab@gmail.com), 23 Jan 2016 FreeBSD-style copyright and disclaimer apply */ #include "bench.h" #include "utils/time.h" #include <time.h> #include <stdio.h> #include <stdlib.h> #include <string.h> // ----------------------------------------------------------------------------- // ...