language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* * This file is part of the AprilTag library. * * AprilTag is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * April...
C
/* Да се напише програма на С, която получава като параметър команда (без параметри) и при успешното ѝ изпълнение, извежда на стандартния изход името на командата. */ #include <err.h> #include <stdlib.h> #include <stdio.h> #include <sys/wait.h> #include <sys/types.h> #include <unistd.h> int main (int argc, char* argv...
C
/* This is a function that calls * the code of Xiaoyu Hu, et al * to generate LDPC codes using * Progressive Edge Growth * Author: Hatef Monajemi (monajemi@stanford.edu) * Date : 11 Feb 2013 * PS: We are interested ONLY in regular graphs * therefore a degree value 'd' would suffice and * we do not require ...
C
/** * intPDBOneShotTest.c * Programmable Delay Block (PDB) one shot interrupt test program * * ARM-based K70F120M microcontroller board * for educational purposes only * CSCI E-92 Spring 2014, Professor James L. Frankel, Harvard Extension School * * Written by James L. Frankel (frankel@seas.harvard.edu) */ ...
C
#include <cc_stats_log.h> #include <cc_debug.h> #include <cc_log.h> #include <cc_metric.h> #define STATS_LOG_MODULE_NAME "util::stats_log" #define STATS_LOG_FMT "%s: %s, " #define PRINT_BUF_LEN 64 static struct logger *slog = NULL; static bool stats_log_init = false; static char buf[PRINT_BUF_LEN]; void stats_log...
C
/* 1048. ּ(20) Ҫʵһּܷ ȹ̶һAһB ÿ1λAĶӦλϵֽ㣺 λӦλӺ13ȡࡪ J10Q11K12żλ BּȥA֣Ϊټ10 λΪ1λ ʽ һθABΪ100λ Կոָ ʽ һܺĽ 1234567 368782971 3695Q8118 */ #include<stdio.h> #include<string.h> int main(){ char s1[103],s2[103],s3[103]={'\0'}; int len1=0,len2=0,len3=0,i=0; scanf("%s",s1); scanf("%s",s2); len1=strlen(s1); len2=strlen(s...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <netinet/in.h> #include <sys/socket.h> #include <sys/wait.h> #include <arpa/inet.h> #include <openssl/ssl.h> #include <fcntl.h> #include <sys/epoll.h> #include <sys/time.h> #include <sys/resource.h> #define MAXBU...
C
/* * Nome: Rodrigo Villardi Cortezi * Matricula: 1511425 */ typedef struct page Page; Page *create_page(); void allocate_page(Page *page, unsigned int page_frame); void deallocate_page(Page *page); void set_modified(Page *page, int modified); void set_referenced(Page *page, int referenced); void set_last_acce...
C
//#include <stdio.h> // //int main(void) { // int i;//ݺ // char string[20] = "Dreams come true", string2[20], * ptr1, * ptr2;//迭 ʱȭ Ÿ 迭 , ׸ // ptr1 = string;//ʱȭ 迭 Ϳ Ҵ // printf("string ּ = %u \t ptr1=%u\n", string, ptr1);//Ҵ Ϳ 迭 ּҰ . // printf("\n string = %s \n ptr1=%s", string, ptr1);//Ϳ 迭 Ҵϸ 迭ó ִ. // printf(...
C
/*Faça um programa onde o valor da variável é alterado através do ponteiro e valor alterado é impresso na tela com printf.*/ #include <stdio.h> void main() { int variavel = 1; ///Nesse local tem que declarar o ponteiro e passar o endereço da variavel para o ponteiro] int * ponteiro = &variavel; //Nesse local tem q...
C
/* * Spring 2019, COMP 211: Lab 2 * Examples of core C programming instructions * */ #include <stdio.h> int main(void) { /* * Arithmetic operations */ int u = 5 + 2; // 7 int v = 10 - 3; // = 7 int w = 5 / 2; // = 2 double x = 5 / 2; // = 1.5 int y = 5 * 2; // = 10 /* ...
C
/*Nome: Victor Hugo Rodrigues da Silva; Matricula: 1512130063; exerccio: sem recurso fibonacci; vero:1; Turma: Quarta-feira / Noite;*/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "code.h" /* run this program using the console pauser or add your own getch, system("pause") or input loop */ in...
C
/* * * среда, 16 сентября 2015 г. 17:23:24 (EEST) * */ #ifndef _ARRAYS_H_ #define _ARRAYS_H_ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <stdint.h> #include "mem_pool.h" unsigned int hash32(char *key); /* * * arrays by key * */ typedef struct _array_key_node_t { struct _array...
C
#include <stdio.h> int main() { int x,y; printf ("Please enter integers x, y\n"); scanf("%d %d",&x,&y); if (x!=y) { printf ("\nx and y are different\n"); } else { printf ("\nx==y\n"); } return 0; }
C
#include <stdio.h> #include <stdlib.h> void read_n(int *); void PrintData(int, int *, int); void Split(int, int, int *, int); int input(const char *, int *); main() { /* Initializing variables */ int n, *A; /* I/O flow && VarCheck */ read_n(&n); /* Main part */ A = (int *) malloc(sizeof(int...
C
#include "mg_header.h" int client_num = 4; // 기본 값. int discussion_time = 10; // 기본 10초. int killnum = -1; // 죽는 자의 번호. struct mymsgbuf mesg; int msgid, len; key_t key; key_t sh_key; // 메세지 관련 변수들. struct sigaction act; // sigaction 구조체 포인터 변수. FILE *rfp, *wfp; // 파일 구조체 포인터 char * nameofjobs[5]={"host","mafia",...
C
/* logwatch.c - A very basic log watcher */ /* $Id$ */ #include "copyright.h" #include "autoconf.h" extern char *optarg; int main(argc, argv) int argc; char *argv[]; { char *searchstr = (char *) NULL; char *logfile = (char *) NULL; char *s = (char *) NULL; FILE *fptr; int c=0, delay=0, timeout=3...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_STRING_LENGTH 15 // CONST: maximum length of a string #define OUTPUT_FILE "/home/brian/School/'07 - Fall/CSCI 1111/Assignment 11/output.dat" // CONST: output file disk path #define FILE_WRITE "w" // CONST: ...
C
#include <poll.h> #include <fcntl.h> #include <errno.h> #include <string.h> #include <stdint.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <err.h> #include <sys/timerfd.h> void error(const char* msg); void errorx(const char *msg); void ignore_lines(void); void wexecute(time_t sec, long nsec,...
C
#include <string.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> //value should be for size of one request == 4*number of features in request (4 bc of 4bytes/word) #define MAXBUF 324 int main(){ //hardcode fifo names, these don't need to be flexible const...
C
#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> #include <limits.h> void traverse(char const *dir) { char name[PATH_MAX]; DIR *d; struct dirent *dd; off_t o; struct stat s; char *delim = "/"; if (!strcmp(dir, "/")) delim = ""; if (!(d = opendir(dir))) { perror(dir); retur...
C
#include<stdio.h> #define N 4 typedef struct Student{ int id, score; }Student; Student fun(Student s[]) { int score = 101; Student tmp; for(int i = 0; i < N; i++) { if(score > s[i].score) { score = s[i].score; tmp = s[i]; } } return tmp; } ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> /** * Return an array of arrays of size *returnSize. * The sizes of the arrays are returned as *columnSizes array. * Note: Both returned array and *columnSizes array must be malloced, assume caller calls free(). */ bool is_palindrome(...
C
#include "Wire.h" #define DS3231_I2C_ADDRESS 0x68 #define PINLED 13 #define PININTERRUPT 2 /* Permet de setter une alarme, de setter le temps, de lever une interruption si le temps et l'alarme s'égalent. Ca allume une LED pour le montrer Supposé fonctionner mais j'ai fait une petit erreur ajd (09-03-2017)*/ struct T...
C
// Author: Wheeler Law // Implementation of interp.h #define _GNU_SOURCE #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include "parser.h" #include "interp.h" #include "symTbl.h" /** ** Runs the entire program. Takes in command line arguments, calls parser ** function as many times as specified. Print...
C
#include<stdio.h> #include<fcntl.h> #include<unistd.h> //#include<sys/stat.h> //#include<sys/types.h> int main() { int ret; ret = fork(); //getpid(); ret = fork(); printf("ret=%d\n",ret); printf("ret=%d\n",ret); //printf("%d\n",getpid()); #if 0 if(ret==0) { // ret = fork(); // getpid(); // printf("%d\n",ret);...
C
#include<stdio.h> /* maximum of two integers */ int max(int a, int b) { return (a > b)? a : b; } // Returns capacity W int knapSack(int W, int weight[], int value[], int n) { int i, w; int K[n+1][W+1]; /* Build table K[][] in bottom up manner */ for (i = 0; i <= n; i++) { for (w = 0; w <= W; w++) { if (i==0 || w==0...
C
#ifndef COMMON_STRUCTS_LINKED_LIST_H #define COMMON_STRUCTS_LINKED_LIST_H #ifdef __cplusplus extern "C" { #endif #include <stdlib.h> struct linked_list { struct linked_list *next; int value; }; typedef struct linked_list linked_list; // Constructor linked_list *linked_list_create(); // Operations void l...
C
#include <terezi.h> #include <stdlib.h> #include <string.h> #include "util.h" /*\ * Double Linked List \*/ tz_dlist *tz_dlist_init(void (*delete)(void *data)) { tz_dlist *l = malloc(sizeof(tz_dlist)); if (!l) die("tz_dlist_new(): malloc():"); memset(l, '\0', sizeof(tz_dlist)); l->destroy = delete; return l; } v...
C
#include "draw.h" #include <GL/glut.h> void draw_model(const Model* model) { glPushMatrix(); glTranslatef(model->position.x, model->position.y, model->position.z); //modell mozgatsa glRotatef(model->rotation.z, 0, 0, 1); //modell forgatsa glRotatef(model->rotation.y, 0, 1, 0); ...
C
#include <stdio.h> #include <stdlib.h> int main() { //punteros int *punteroNumero; int numero; int numeroDos; numero=66; punteroNumero=&numero; numeroDos=&numero;// de memoria printf("\n a- %d",numeroDos); numeroDos=*punteroNumero; // de valor printf("\n b-%d",numeroDos); pr...
C
#include <unistd.h> #include <stdio.h> #include <signal.h> #include <stdlib.h> void c_response(int sig) { printf("Ctrl + C detected!\n"); sleep(5); } int main(void) { struct sigaction act; //建一个act 结构体 act.sa_handler = c_response; //挂上捕捉处理函数 sigemptyset(&act.sa_mask); //给一个空 mask sigaddset(&...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fillit.c :+: :+: :+: ...
C
#include<stdio.h> #include<string.h> void print_result(int n);/*配列を出力する関数*/ void des_sort(int array[],int N);/*配列を降順にする関数*/ void havel(int array[],int N);/*havel-hakimiの動作を行う関数*/ int have_minus(int array[],int N);/*最後の出力結果を決めるジャッジを行う*/ int juge_loop(int array[],int N);/*havel-hakimi自体をループで行うかどうかを判定する関数*/ int main...
C
#define MAX 9 static char* g_table[] = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; char **res = NULL; char* ans = NULL; int g_count = 0; //int vis[10][4] = {0}; void step(char *digits, int box, int box_max) { int i; if (box == box_max) { memcpy(res[g_count], ans, strlen(ans)); g_count++;...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
/************************************************************************** memleak.c: A simple module for debbuging memory leaks. ANSI C. Copyright (c) 2005, 2008 Stanislav Maslovski. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License ...
C
#include <stdio.h> #include <float.h> int main(void) { float number, division; printf("Enter your number(a float number):"); scanf("%f %f", &number, &division); printf("the number:%10.3f \n", number/division); printf("the exponetial notation:%3.2e\n", number/division); printf("the double num...
C
#include<stdio.h> #include<stdlib.h> #define infinity 9999 #define MAX 20 int G[MAX][MAX],spanning[MAX][MAX],n; typedef struct edge{ int u,v,w; }edge; typedef struct edgelist{ edge data[MAX]; int n; }edgelist; edgelist elist; edgelist spanlist; int prims(); void kruskal(); int find(int belongs[],int v...
C
#include <unistd.h> void ft_putchar(char c) { write(1, &c, 1); } /*void cross(char *tab, int o, char save, int x, char tall) { char tall2; int save2; tall2 = tall; save2 = save; while (tall2 > '0') { tab[save / x + 1] = 'x'; while (tall2 > '0') { tab[save2--] = 'x'; tall2--; } } } */ void c...
C
#include "ush.h" static void set_fds(int *fds, int *savedFds) { savedFds[0] = dup(0); savedFds[1] = dup(1); if (fds) { dup2(fds[0], 0); dup2(fds[1], 1); } } static int mx_exec_buildin(t_token *token, int *fds, char operator_starus, t_info *info) { int sav...
C
#include <stdio.h> int main() {//Найти в строке заданный символ. int i=0, k=0; char a, str [100]; scanf ("%c ", &a); fgets (str, 100, stdin); fflush (stdin); while (str[i]!='\n') { if (str[i]==a) {printf ("%d\n", i); k=1; break;} i++;} if (k==0) prin...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* builtin_setenv.c :+: :+: :+: ...
C
#include "holberton.h" #include <stdio.h> /** * reverse_array - reverses an array * @a: first parameter * @n: second parameter * * Description: where n is the no. of elements * Return: Always(0) Success */ void reverse_array(int *a, int n) { int hold, first, last; first = 0; last = n - 1; for (first = 0; ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "mylib.h" #include <math.h> #define MAX_NUM_OF_HOSPITALS 16 #define MAX_NUM_OF_BEDS 16 typedef struct { long int x; long int y; } coordinate_t; long int calculate_distance(coordinate_t, coordinate_t); typedef struct person { char surnam...
C
#include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <fcntl.h> #include <time.h> #include <string.h> #include <sys/wait.h> #include <signal.h> pid_t pgid; //group pid static volatile pid_t latest_sending_chld_pid = 0; //who sent sigusr1 /* Queue for dead children */ struct chldQueue { siginfo_t sta...
C
#include "../src/ccobs.c" #include <stdbool.h> #include <stdio.h> #include "unity.h" void test_stuff_single_byte() { char unstuffed[1] = {0}; size_t unstuffed_length = 1; char stuffed_expected[3] = {1, 1, 0}; char stuffed_actual[999] = ""; size_t stuffed_actual_length = 0; // @todo // @todo ...
C
/* Convert a Stereo file into a Mono wave file by concatenating the left channel data together. Passes determined values from wav file into FFT function. Normalizes values based on the range, outputted values are from 0-1. Writes output to text file for use with the spectrogram display code. */ #incl...
C
#include "libft.h" int ft_atoi(const char *str) { int x; long y; x = 1; y = 0; while (((*str > 8) && (*str < 14)) || *str == 32) str++; if (*str == 43 || *str == 45) { if (*str == 45) x = -x; str++; } if (*str < 48 || *str > 57) return (0); while ((*str > 47) && (*str < 58)) { y = y * 10 + (*...
C
/* DESCRIPTION: implementation of LD AUTHOR: Jono Davis DATE: 10/17 */ #include <stdio.h> #include <string.h> #include <ctype.h> typedef struct { int address; char label[5]; } data; int main(int argc, char *argv[]) { /* LC3 FILE */ FILE *fp; fp = fopen(argv[1], "r"); char buff[255]; char *sep = ", "; int ...
C
#include "shell.h" /** * _getenv - This function looks for a path in the environment. * @command: The command of the environment variable. * Return: A pointer to path of the variable. */ char *_getenv(const char *command) { unsigned int length = 0, i = 0; char *pos = NULL, *str = NULL; length = _strlen(comma...
C
/* 461. Hamming Distance The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calculate the Hamming distance. Note: 0 x, y < 231. Example: Input: x = 1, y = 4 Output: 2 Explanation: 1 (0 0 0 1) 4 (0 1 0 0) ...
C
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #define REP(i,a,b) for(i=a;i<b;i++) #define rep(i,n) REP(i,0,n) int dp[200][3][3]; int fg[3000]; int debug = 0; int mp[200][2]; int get_grundy(int n){ int i, j, k; int all, up, down; k = 0; rep(i,n){ if(mp[i][0] && mp[i][1]) cont...
C
#define q14_h #include "library.h" // QUESTÃO 14 // Utilizando o algoritmo shellsort visto em aula, implemente‐o em C para que ordene // em ordem decrescente e obtenha o número de comparações e movimentações para o // seguinte vetor: 8,12,19,43,45,56,67,95 void shellSortDesc(int n, int* v){ clock_t tInicio, tF...
C
float medianArrays(int a[], int b[], int asize, int bsize) { int k=0, i=0, j=0, n=asize+bsize; int arr[n]; while(i<asize && j<bsize) { if(a[i]<=b[j]) arr[k++] = a[i++]; else arr[k++] = b[j++]; } while(i<asize) arr[k++] = a[i++]; while(j<bsize) arr[k++] = b[j++]; float m; if(n%2==0) m = ((float)...
C
/***************************************************************************** * hdb.c * * Computer Science 3357a - Fall 2015 * Author: Jerridan Quiring * * Implements the functions of libhdb ****************************************************************************/ #define _GNU_SOURCE #include <stdlib.h> #...
C
#include "holberton.h" /** * _strspn - the length of a string containing only chars from another * @s: pointer to the buffer (memory space) * @accept: pointer to string * Return: unsigned int with length */ unsigned int _strspn(char *s, char *accept) { unsigned int i, a, sum = 0; for (i = 0; s[i] != '\0'; i++) ...
C
#include<stdio.h> void main() { int a, b, c; printf("input a,b,c\n"); scanf_s("%d%d%d", &a, &b, &c); printf("a=%x,b=%x,c=%x", &a, &b, &c); }
C
#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <time.h> int main() { srand((unsigned int)time(0x0)); int counter = 53, j=0, x; while(counter) { do{ x = rand()%52; printf("%d , ", x); } w...
C
#include <stdio.h> int main(void){ signed char c = -100; unsigned long nl; nl = -10 + c; printf("%lu\n",nl); }
C
#include "../inc/libmx.h" char *mx_strjoin(const char *s1, const char *s2) { char *join; if (NULL == s2 && NULL == s1) return NULL; if (NULL == s2 || NULL == s1) { join = !s2 ? mx_strnew(mx_strlen(s1)) : mx_strnew(mx_strlen(s2)); join = !s2 ? mx_strcpy(join, s1) : mx_strcpy(join, s...
C
#include<stdio.h> void inputnum(int *n,int *r) { printf("Enter the values of n and r to calculate ncr and npr\n"); scanf("%d%d",n,r); } void factorial(int n,int r,int *factn,int *factr,int *factnr) { int sum1=1,sum2=1,sum3=1,i; for(i=1;i<=n;i++) { sum1=sum1*i; } for(i=1;i<=r;i++) { sum2=sum2*i; } for(i=1...
C
/*! * \file sketch_support.c * * \brief Support routines for managing bitmaps used in sketches */ /*! @addtogroup grp_desc_stats * * @par About: * MADlib provides a number of descriptive statistics to complement * SQL's builtin aggregation functions (COUNT, SUM, MAX, MIN, AVG, STDDEV). * When possible we try...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 20000 void find_fruit(char input[],char fruit[][15]); int main(void) { char fruit[20][15] = { "guava", "litchi", "longan", "watermelon", "pomelo", "pear", "bana...
C
/* * critical.c * * Created on: 2014-03-02 * Author: Jonah */ #include "critical.h" #include "basicmath.h" #include "qsort_small.h" #include <altera_avalon_pio_regs.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include "qsort_large.h" void write_led(int count) { IOWR_ALTE...
C
/* Takes a number and generates a factor tree */ #define _CRT_SECURE_NO_WARNINGS #include "PeggyUtil.h" #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <Windows.h> #define CON_BUFFER_SIZE 100 /* Struct defs */ typedef struct AFactor AFactor; struct AFactor { int number; bool hasFactors; ...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<time.h> /* * Lucas Melo e Mayko de Oliveira * * Programa de ordenao MergeSort * O vetor de elementos divido em pares de elementos e ento os pares so * ordenados, depois so agrupados de dois em dois pares e ento os valores do * grupo so ordena...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> double calc(double x, double y, double z) { int n0=1; int n1=1; if ((n0+1)*abs(x+y)==0) {return NAN;}; if (z==0) {return NAN;}; if ((y-x)==0) {return NAN;}; if ((y-x)<0&&((1/z)-(int)(1/z))!=0) {return NAN;}; if (x<0&&((y+1)-(int)(y+1))!...
C
#include "func.h" Queue *head1 = NULL, *tail1 = NULL, *head2 = NULL, *tail2 = NULL; List *head = NULL, *tail = NULL; /* ( )*/ void Enqueue(int queue_num, int amount, int *arr) { Queue *head, *tail; /* */ int i; Queue* p; /* */ if (queue_num == 1) { head = head1; ...
C
#include <stdio.h> #include <ctype.h> int main() { int c, i, sum; sum = 0; while ((c=getchar()) != EOF) { if (c == '\n') putchar(c); else if (c == '!') putchar('\n'); else if (isdigit(c)) sum += (c-'0'); else { for (i=0; i<sum; i++) { if (c == 'b') putchar (' '); else putc...
C
#include <netdb.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <signal.h> #include <netinet/in.h> #include <sys/time.h> #i...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include "seed.h" #include "template.h" #include "debug.h" static template_t *template = NULL; typedef struct SP_entry { char entity[128]; char date[64]; char to[16]; char from[16]; char action[16]; char type[16]; #define SP_ENTRY_NEW...
C
/* Copyright (c) 1987, 1989, 2012 University of Maryland Department of Computer Science. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without li...
C
#include "../../headers/global_header.h" /* Retourne un nouvel allié. */ Friend get_new_friend(Friend_Spawner *spawner, int posX, int posY) { Friend f; f.id_friend = spawner->id_friend; f.ability = spawner->ability; f.DELAY_ABILITY = spawner->DELAY_ABILITY; f.delay_ability = spawner->DELAY_ABILITY; f....
C
// // Created by Sakura on 3/8/2021. // typedef struct { int day; int month; int year; }Date; typedef struct { char* type; char* destination; char* departure_date; Date detailed_date; double price; }Offer; Offer* create_offer(char*, char*, char*, double); Offer* copy_offer(Offer*); ...
C
/** * @file ArrayBubbleSortStrategy.c * @brief Array Bubble Sort Strategy * @author Taro Hoshino * Copyright (C) 2017 Taro Hoshino. All Rights Reserved. */ #include "ArrayBubbleSortStrategy.h" #include "Array.h" /*************************** * Function ***************************/ /...
C
/* ============================================================================ Name : INFO1MI2020_labo4.c Author : E.ZYSMAN Version : 1 Copyright : Your copyright notice Description : JOUER AUX DéS in C, Ansi-style ============================================================================ *...
C
int conta_bits_um_c(int x){ int i, aux = 0, count = 0; for (i = 0; i < 32; i++){ aux = x & 1; if (aux == 1){ count++; } x = (x >> 1); } return count; }
C
#include <stdio.h> int main() { int i,n1,n2; scanf("%d%d", &n1,&n2); if((n1 % 2) != 0) printf("O PRIMEIRO NAO E PAR\n"); else{ printf("%d ", n1); for(i=1; i < n2; i++){ n1 = n1+2; printf("%d ", n1);} } return 0; }
C
/*FUNCTION CODE TO DELETE A NODE TO WHICH A POINTER IS GIVEN IN A LINKED LIST AS THE ADDRESS WE CANNOT DEFINE SO ONLY CODE OF FUNCTION PRESENT*/ #include<stdio.h> typedef struct node { int info; struct node *next; }nodetype; void deleteForPointer(nodetype *ptr) { if(ptr!=NULL) { if(ptr->next!=NULL) { ptr->info=(ptr->...
C
// // compressECGData.c // compressECGData // // Created by Realank on 2017/4/17. // Copyright © 2017年 Realank. All rights reserved. // #include "compressECGData.h" #define BufferSize 1024*16 uint8_t queue = 0; int position = 0; int pushToQueue(uint8_t data, uint8_t* popData){ if (position == 0) { ...
C
#ifndef WORD_H #define WORD_H #define CHARSIZE (4) typedef struct char_s { unsigned char c[CHARSIZE]; } char_t; typedef struct word_s { char_t * w; // string int l; // length of the word } word_t; typedef struct words_s { word_t * w; // words array int l; // length of words list } ...
C
#include <stdio.h> #include <windows.h> #include <winioctl.h> int main(int argc, char *argv[ ]) { BOOL b; DWORD FsFlags; LPSTR lp; HANDLE hMod; UINT w; CHAR FileName[MAX_PATH]; HANDLE hFile; DWORD Nbytes; DWORD FileSize; WORD State; DWORD Length; DWORD...
C
#ifndef PS2_H #define PS2_H /* * Module that communicates with a PS2 device such as a keyboard * or mouse. * * Students implement this module in assignments 5 and 7. * * Author: Julie Zelenski <zelenski@cs.stanford.edu> * * Last edited Feb 2021 */ #include <stdbool.h> typedef struct ps2_device ps2_device_t;...
C
#include <gtk/gtk.h> #include "listOfProcess.h" #include <sys/sysinfo.h> #include <cairo/cairo.h> #include <stdio.h> #include <stdlib.h> #define WIDTH 640 #define HEIGHT 480 #define ZOOM_X 10.0 #define ZOOM_Y 10.0 static int cpus; typedef struct { GtkListStore * str; GtkTreeIter iter; GtkDrawingArea * da...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <locale.h> #define EPSILON 0.00000001 // Alocação, leitura e escrita de matrizes double **alocaMatriz(int l, int c) { // aloca espaço na memória para a alocação da matriz // Se houver espaço: aloca dinamicamente uma matriz[l][c] (s...
C
#include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> //#define _LOCK_ // == gcc -D_LOCK_ void *func(void *arg); pthread_mutex_t mutex; int count = 0; int value1, value2; int main() { pthread_t pthread; if(pthread_mutex_init(&mutex, NULL)<0) { perror("pthread_mutex_init"); exit(-1); ...
C
#include<stdio.h> int main() { float A,b,h; printf("Enter the value of base="); scanf("%f",&b); printf("Enter the value of height="); scanf("%f",&h); A=(b*h)/2; printf("Area of triangle=%f",A); return 0; }
C
//This program finds the all posible occurence of Sub string in Super String. #include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <assert.h> #include <limits.h> #include <stdbool.h> int appearanceCount(int input1,int input2,char* input3,char* input4) { int i,j,k,cou...
C
#incluir <> stdio.h #include <stdlib.h> // atoi, atof #incluir <stdbool.h> // break (creo) #definir TAM 10 //sin ; y = int lista[TAM]= {11,12,13,14,15,16,17,18,19,20}; int idx=0; int main(int argc, char** argv){ for( int index=1; índice <= TAM; índice++){ printf("Índice: %d, Valor: %d \n\a",...
C
#include <pebble.h> static Window *s_main_window; static TextLayer *s_time_layer,*s_date_layer; static TextLayer *s_food_layer; static BitmapLayer *s_background_layer; static GBitmap *s_background_bitmap; static char date_buffer[16]; char* lunchToday(char* dateInput){ char *lunch; switch (dateInput[0]){ ...
C
#include <string.h> #include <stdio.h> #include <stdlib.h> #include <search.h> #include "chin_lib.h" #define MXLGH 1000000 void usage(); int nd_cmp(const void *x,const void *y); void action(const void *nodep, const VISIT which, const int depth); void remove_node(const void *x); typedef struct pattern_node{ char ...
C
#include <stdio.h> #include <stdlib.h> #include <SDL.h> #include <math.h> #define WIDTH 1000 #define HEIGHT 1000 #define BPP 4 #define DEPTH 32 #define NB 3000 void setpixel(SDL_Surface * screen, int x, int y, Uint8 r, Uint8 g, Uint8 b) { if(x >= WIDTH || y >= HEIGHT || x < 0 || y < 0) return; Uint32 *pixmem32; Uin...
C
#include<stdio.h> #include<string.h> int main() { char str[104]; int i,T,j,sum,l; scanf("%d",&T); for(i=1;i<=T;i++){ sum = 0; scanf(" %[^\n]",str); l = strlen(str); for(j=0;j<l;j++){ if((str[j]=='a')||(str[j]=='d')||(str[j]=...
C
/* stmnt.c af_statement functions */ #include "arpfit.h" #include <sstream> /* -------------------------------------------------- */ /* Print functions */ /* -------------------------------------------------- */ char *af_statement::parsed() const { std::ostringstream ss; printOn(...
C
#pragma once void multiply(int F[2][2], int M[2][2]) { int x = F[0][0]*M[0][0] + F[0][1]*M[1][0]; int y = F[0][0]*M[0][1] + F[0][1]*M[1][1]; int z = F[1][0]*M[0][0] + F[1][1]*M[1][0]; int w = F[1][0]*M[0][1] + F[1][1]*M[1][1]; F[0][0] = x; F[0][1] = y; F[1][0] = z; F[1][1] = w; } ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include "types.h" SP_Answer splitPlainMsg(char *rcvBuffer);/*버퍼 내용을 구조체로 변환하는 함수*/ SP_Alternative splitModifiedMsg(char *rcvBuffer);/*버퍼 내용을 구조체로 변환하는 함수*/ void plainAnswerHandler(SP_Answer rcvdAnswer, int *loop);/*기본 응답 처리*/ vo...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* copy_paste.c :+: :+: :+: ...
C
#include <stdio.h> int main() { long long n; long long k; long long m; long long sum; scanf("%lld %lld", &n, &k); sum = n; m = sum; while (m - k >= 0) { m = m - k; sum++; m++; } printf("%lld", sum); return 0; }
C
/* ** EPITECH PROJECT, 2018 ** libmy ** File description: ** memset.c */ #include "my/memory.h" void *my_memset(void *dest, byte_t c, size_t n) { byte_t *d = dest; if (!dest || n == 0) return (NULL); while (n--) *d++ = c; return (dest); }