language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdbool.h> #include "game.h" #include "utils/game_utils.h" #include "utils/game_gtk_utils.h" #include "../app/app.h" #include "../connection/connection.h" #include "../modals/modals.h" static gchar *GAMEPLAY_PAGE_STRING = GAMEPLAY_PAGE; static GtkGrid *board; static GtkLabel *stateLabel, *wonLostCountLabel...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "domino.h" int main() { int deckPieces = 0; int tablePieces = 0; int player1Pieces = 0; int player2Pieces = 0; DominoPiece *deckParts = NULL; DominoPiece *tableParts = NULL; DominoPiece *player1Parts = NULL; DominoPiece *player2Parts = NULL; ...
C
/** * @file 17.c * * @brief Number letter counts * * If the numbers 1 to 5 are written out in words: * one, two, three, four, five, * then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. * * If all the numbers from 1 to 1000 (one thousand) inclusive * were written out in words, how many letters would ...
C
/* Includes ------------------------------------------------------------------*/ #include "AT_UART.h" /******************************************************************* * : void Mcu_UartxSendByte(UART_HandleTypeDef huart,char dat) * : ʹ * : * : * : * ע : *********************************************...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
#include <asf.h> /* * Test program for reaction test setup * Author: Philip Ekholm */ #include "console_driver.h" #include "pin_mapper.h" #define LEFT_LED 53 #define MIDDLE_LED 51 #define RIGHT_LED 49 #define BTN1 47 #define BTN2 45 #define VCC 43 void enable_pins(void) { ioport_enable_pi...
C
#include <stdio.h> #include <assert.h> unsigned pwr2k (unsigned k) { return 1U << k; } unsigned div_by_2k (unsigned x, unsigned k) { return x >> k; } unsigned div_by_2k_check (unsigned x, unsigned k) { return x / pwr2k(k); } int sdiv_by_2k (int x, unsigned k) { return (x < 0 ? x + (1 << k) - 1 : x) ...
C
#include <stdio.h> #include <string.h> int verificaString (char *str1, char *str2) { int i, j, contagem = 0; for (i = 0; i < strlen(str1) - 1; i++) { if (*(str2+0) == *(str1+i)) { for (j = 0; j < strlen(str2) - 1; j++) { if (*(str2+j) == *(str1+(i++))) { contagem++; } } ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> static void app_do(void); /** * @brief main */ int main(int argc, char *argv[]) { #ifdef __COVERAGESCANNER__ __coveragescanner_install("app"); __coveragescanner_clear(); __coveragescanner_testname("app_coverage"); #endif app_do(); #ifd...
C
/* * Company.h * * Created on: May 30, 2017 * Author: Noam */ #ifndef COMPANY_H_ #define COMPANY_H_ #include "mtm_ex3.h" #include "room.h" #include "set.h" #include "list.h" #include <stdlib.h> #include <stdbool.h> typedef struct company *Company; /** * This type defines all errors for the company. */ ...
C
//Accepted #include<stdio.h> #include<string.h> #include<math.h> #include<stdlib.h> #include<stdbool.h> double b=180000.0,c=300000.0,d=400000.0,e=300000.0; int main() { double a,q; long long sum; int i=1,j,k,T; scanf("%d",&T); while(i<=T) { sum=0; scanf("%lf",&a);...
C
#include<stdio.h> int main() { int i,j,n,sum=0,pro; printf("Series: 1+ (1*2)+ (1*2*3)+....+ (1*2*3*...*n)"); printf("Enter number of n\n"); scanf("%d",&n); for(i=1; i<=n; i++) { pro=1; for(j=1; j<=i; j++) pro*=j; sum+=pro; } printf("Sum of Series : %d\...
C
#include "protocol_receiver.c" #include "../app_utils.c" #include <math.h> /** * funcao que verifica se o pacote recebido é o pacote END * @param start pacote START recebida anteriormente * @param sizeStart tamanho da pacote START * @param end mensagem lida a verificar se é END * @param sizeEnd tamanho dessa mesma...
C
#include<stdio.h> main() { //1.Display the menu printf("pick an item : \n1. Pen\n2. Pencil\n3. Eraser\n4 .Book"); //2.Read their choice int choice=0; scanf("%d",&choice); //3.Display based on their choice switch(choice) { case 1: printf(" You picked Pen."); break; case 2: printf(" You picked Penc...
C
#include <stdio.h> int sum (int sum) { static int realSum = 0; realSum = realSum + sum; return realSum; } int main () { printf("%d ", sum(25)); printf("%d ", sum(15)); printf("%d ", sum(30)); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include "cs_decode.h" #include "schema.h" static int value_callback(const cs_path_t *path, int value) { for (unsigned i = 0; i < path->depth; i++) { printf(" "); } printf("%d: %d\n", path->values[path->depth - 1], value); return 0; } static int enter_e...
C
/*##################################### TIM ################################### : 1. RCC->APB2ENR (TIM 1,8,9,10,11) RCC->APB1ENR () RCC_APB1ENR_TIMEN, - . 2. TIM->CR2, - . 3. TIM->DIER, - : TIM_DIER_UIE - (?); TIM_DIER_UDE - DMA (?). 4. TIM->PSC 5. TIM->ARR ...
C
/* * tiny_avr_application.c * * Created: 29/04/2020 8:40:49 PM * Author : lance initial design is for portrait orientation */ #include <avr/io.h> #include "lcd_library.h" #include "colors.h" #define BUTTON_PRESSED (!(PINB) && (1<<BUTTON)) void display_1(); void display_2(); void displa...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <pmmintrin.h> // Print all elements of vector: void vec_print(float* vec, unsigned int element_count) { for (size_t i = 0; i < element_count; i++) { printf("vec[%zu]=%.2f\n", i, vec[i]); } } // Set vector 'out' to 1..element_count // Set all ...
C
#include <stdio.h> int main(void) { char str[20]; scanf("%s",str); for(int i=0;str[i]!='\0';i++) { if(str[i]>96) { str[i]=str[i]-32; } else if(str[i]<91) { str[i]=str[i]+32; } } printf("%s",str); return 0; }
C
#include<stdio.h> #include <stdlib.h> int main(){ // Writing to a file FILE* fpointer1 = fopen("employees.txt", "w"); // Like printf but for files fprintf(fpointer1, "Jim, Sales\nPan, Reception\nOscar, Accounting"); fclose(fpointer1); // Closes file // Reading from a file char line[255]; FILE* fpointer2 =...
C
#include <sys/socket.h> #include <netinet/in.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <arpa/inet.h> #include <unistd.h> main() { int sock_desc = socket(AF_INET, SOCK_STREAM, 0); char sbuff[1024]; if(sock_desc == -1) { printf("cant create socket\n"); return 0; } ...
C
#include <stdio.h> #include <Python.h> PyObject *getMatrixItem(PyObject *matrix, uint32_t x, uint32_t y) { if (y < PyList_Size(matrix) && x < PyList_Size(PyList_GetItem(matrix, y))) { return PyList_GetItem(PyList_GetItem(matrix, y), x); } return PyFloat_FromDouble(0); } static PyObject *dot(PyObje...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <signal.h> void pcount(int n, siginfo_t *sig, void *ptr) { static int num = 0; printf("i'm parent now is %d\n",num); num += 2; sleep(1); kill(sig->si_pid, SIGUSR2); } void ccount(int n, siginfo_t *sig, void *ptr) { static int num = 1; pr...
C
/* * Thaddeus002's pccts * * Public Domain. */ /** * \file utils.h * \brief Utilitaries functions for strings handling. */ #ifndef __UTILS_H__ #define __UTILS_H__ /** * Compare two strings case insentive way. * \return 1 if the strings are equal, 0 otherwise */ int ci_strequ(char *a, char *b); /** * Che...
C
/*! ************************************************************************ * * Copyright (C) 2020 netforklabs All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * ...
C
/* SPDX-License-Identifier: ISC */ #include <sys/types.h> #include <sys/stat.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <signal.h> #include <stdio.h> #include <errno.h> #include "servicecmd.h" static int cmd_disable(int argc, char **argv) { int ret = EXIT_FAILURE; char *linkname, *ptr; ...
C
#include<stdio.h> int main() { int num, index; int flag = 0; while (scanf("%d %d", &num, &index)!=EOF) { if (index != 0) { if (flag) printf(" "); printf("%d %d", num*index, index - 1); flag = 1; } } if (flag == 0) { printf("0 0"); } return 0; }
C
#include "menu.h" //Permet de placer le curseur pour crire des coordones prcises (code trouv sur internet) void gotoxy(int x, int y) { HANDLE hConsoleOutput; COORD dwCursorPosition; dwCursorPosition.X = x; dwCursorPosition.Y = y; hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorPosi...
C
typedef enum { typeConstant, typeIdentifier, typeOperator } nodeTEnum; // a node is of type constant, identifier, or operator /* constants hold only values, e.g. 1, 2, 3 ... */ typedef struct { int value; } constantNodeType; //CSI3120 extern int symbol_table[1000]; // this is a reference to the symbol table speci...
C
#include <stdlib.h> #include <stdio.h> #include <math.h> double calculate_response(double freq, double sigma) { /* magnitude response of discrete gaussian kernel */ /* in frequency domain */ /* input frequency is normalized so that the Nyquist */ /* frequen...
C
#include <stdlib.h> #include <stdio.h> #include "libmccdaq.h" int main() { puts("Opening connection..."); OpenConnection(); puts("Opened connection..."); /* TriangleOnce(1., -10, 10); uint n_channels = sizeof(channels); uint n_samples = 600; double frequency = 500; double * data = calloc(n_samples ...
C
#include "../ft_printf.h" int ft_print_char(t_lst list_flags, va_list argv) { if (list_flags.minus == 1 && list_flags.width > 1) { ft_putchar_fd(va_arg(argv, int), 1); ft_add_width(' ', list_flags.width - 1); return (list_flags.width); } else if (list_flags.minus == 0 && list_flags.width > 1) ft_add_width...
C
#include "instructions.h" #include <stdio.h> #include <stdlib.h> #include <time.h> #include "screen.h" #include "keyboard.h" void sys_addr(Machine *machine, uint16_t opcode) { fprintf(stdout, "Instruction SYS addr (opcode: %x) not implemented. Aborting...\n", opcode); exit(1); } void cls(Machine *machine, uint16_...
C
#include<stdio.h> #include<stdlib.h> #include<math.h> struct POINT{ double x,y; }; struct POLYGON{ int n_v; struct POINT v[105]; double area; int id; }; struct ID_CONTAINER{ int id; int container; }; int compar1(const void *a,const void *b){ struct POLYGON *p1=(struct POLYGON *)a,*p2=(struct POLYGON *)b; if(p1...
C
//这个是用C 语言在求根号二的时候出现的错误; test.c:31:17: error: invalid operands to binary % (have ‘double’ and ‘double’) sp =(double)(x%g); 查了一下,结果表明,只能用int型才行,附上当时写的函数 当时的想法,在进行相除的时候,会有小数点,又想保留多位数的小数点,就将 类型命名为double型的; void genhaosign() { double x = 2; double g = 1; double v =1; double s =0; double sp = 0; double sz = ...
C
#include <stdio.h> #define MAX 100 void maior_menor(int vet[],int t,int a,int b){ int menor = vet[1]; int maior = vet[0]; for(int i = 0; i<t ;i++){ if(vet[i] < menor ){ menor = vet[i]; } else if(maior < vet[i]){ maior = vet[i]; } } a = menor; ...
C
#include "order_system.h" int order_matrix[4][3] = { { 0, 0, 0 }, // first up, elevator, down { 0, 0, 0 }, // second up, elevator, down { 0, 0, 0 }, // third up, elevator, down { 0, 0, 0 } // fourth up, elevator, down }; elev_button_type_t button_type[3] = { BUTTON_CALL_UP, BUTTO...
C
/* * sqlite.c * Cheap Power Meter * Wait for interrupt from Raspberry Pi GPIO board * and insert row into sqlite database. * * Used with light-dependent resistor connected to the Pi, * to measure power usage from fuse box. One blink equals 1 watt hour * * Read more: http://www.hyggeit.dk/2013/04/super-cheap-we...
C
/* Example for tRF Click Date : apr 2018. Author : Katarina Perendic Test configuration PIC : MCU : P18F87K22 Dev. Board : EasyPIC PRO v7 PIC Compiler ver : v7.2.0.0 --- Description : The application is composed of three sections : - System Initialization -...
C
/*> stdgui.h <* * * Date: 25/10/1998 * Last Change: 28/11/1998 * * * By NSJ aka Viriato 1998 * * USE AT YOUR OWN RISK, NO WARANTIES OF ANY KIND ARE GIVEN */ #ifndef __stdgui_h__ #define __stdgui_h__ #ifndef NULL #define NULL 0x0 #endif #define RESETMODE set_wrt_mode(0); #define ...
C
// // link.c // day10 // // Created by waitwalker on 2021/5/19. // #include "link.h" #include <stdlib.h> #include <string.h> /// 做的是头部之前插入 要把这个节点插在head之前 STU *insertLink(STU *head, STU tmp) { /// 第一次的时候链表应该是空的 ///1. 从堆区空间申请一个待插入的节点空间 STU *pi = (STU *)calloc(1, sizeof(STU)); if (pi == NULL) { ...
C
#include<stdio.h> #include<string.h> typedef struct{ char Name[100]; char No[100]; int Grade; }StuType; int main(){ int N,i,j; StuType tmp,max,min; max.Grade=0; min.Grade=100; scanf("%d",&N); for(i=0;i<N;i++){ scanf("%s %s %d",tmp.Name,tmp.No,&tmp.Grade); if(tmp.Grade>m...
C
/************************************************************************************ * Copyright (c) 2017 by Ian G. Tayler <ian.g.tayler@gmail.com> * * This file is part of Markovman. * * ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* rotate.c :+: :+: :+: ...
C
// // test.c // 第一个C程序 // // Created by 潘易 on 14-8-31. // Copyright (c) 2014年 xinlan. All rights reserved. // #include <stdio.h> void test() { printf("Test()函数被调用!\n"); }//end function test() int add(int a,int b) { int ret = a + b; printf("%d + %d = %d\n",a,b,ret); return ret; }//end add f...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "personal.h" extern struct personal_data_format *Data; extern int Data_num; int Attest( void ) { int i; char input_name[50]; char input_pass[50]; printf( "name:" ); scanf( "%s", input_name ); printf( "pass:" ); scanf( "...
C
/* File: list_linked.c */ /* Implementasi Linked List */ #include <stdio.h> #include <list_linked.h> /* Definisi List : */ /* List kosong : FIRST(l) = NULL */ /* Setiap elemen dengan Address p dapat diacu INFO(p), NEXT(p) */ /* Elemen terakhir list: jika addressnya Last, maka NEXT(Last)=NULL */ /* PROTOTYPE */ /****...
C
#include <GL/glew.h> #include <GL/glut.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <stdarg.h> #include <math.h> #include "shaders.h" struct shader_program { GLuint program; GLuint vshad, fshad; char *name; char *vshadName, *fshadName; char *vshadFileName, *fshadFileName; }; static vo...
C
/* 02.02.2021 Ozel Veri Yapisi tanimlama Struct Union yapilarinin ortak kullanimi */ #include <stdio.h> #include <stdlib.h> #pragma pack(1) #define VTTYPE_EMPTY 0 #define VTTYPE_BYTE 1 #define VTTYPE_WORD 2 #define VTTYPE_LONG 3 #define VTTYPE_FLOAT 4 typedef struct MYVAR{ unsigned ch...
C
#include <asm/pic.h> #include <asm/io.h> #include <asm/irq_vector.h> #include <kernel/printk.h> /* * http://www.brokenthorn.com/Resources/OSDevPic.html */ /* * i8259A PIC registers */ #define PIC_MASTER_BASE_ADDR 0x20 /* IO base address for master PIC */ #define PIC_SLAVE_BASE_ADDR 0xa0 /* IO base address for s...
C
#include<stdio.h> #include<string.h> #include<time.h> #include<limits.h> int size_of_file(); void create(); int delete_pair(); void print_all(); void check_every_time(); void call_back_access(); void read(); //Allowing one user to access the file at a time /* 1. checking the presense of file 2.if not creating the fil...
C
void main() { int i; int j; int TID; int nthreads; int n = 3; int cost[10][10]; printf("\nEnter the costs of edges in matrix form :"); #pragma omp parallel default(none),, shared(cost,n) { #pragma omp for for (i = 0; i < n; i++) for (j = 0; j < n; j++) { scanf("%d", &cost[i][j]...
C
#include "ZLG_Key.h" // #include "lcd.h" #include "usart.h" volatile unsigned char zlg_key; volatile unsigned char KeyValue; volatile unsigned char RepeatCnt; volatile unsigned char FnKeyValue; void SystemInit_key() { I2C_Init_me(); delay_ms(300); //ȴZLG7290λ ClearAll(); EXTIX_Init(); } /* ClearAll() ܣʾ ...
C
#include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <unistd.h> #include <fcntl.h> #include <poll.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <signal.h> #include <assert.h> #include <stdio.h> #include <errno.h> #include <stdlib.h> #include <string.h> #include <ctyp...
C
/* ============================================================================ Name : conefinal.c Author : Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #include <stdio.h...
C
#include "manager.h" int listProduct(Product *p, int count){ int i; printf("**************************************************\n"); printf("No.\t이름\t무게(g)\t가격\t별점\t별점갯수\n"); for(i = 0; i < count; i++){ if (p[i].price == -1) continue; printf("%d\t", i+1); readProduct(p[i]); } if(i == 0) ...
C
#if !defined(EVAL_H) #define EVAL_H #include "ops.h" #include "stack.h" typedef struct eval_state { STACK(struct operator) ops_stack; STACK(struct operand) operands_stack; } eval_state; /* Initialize state required for evaluation. Call before eval_with_state() */ bool eval_init(eval_state *s...
C
#include <stdio.h> #include <stdlib.h> int main() { int p,q; scanf("%d%d",&p,&q); int a[q],c,r,i,j,k; double s; for(j=0;j<q;j++) scanf("%d",&a[j]); r=1; for(k=0;k<p;k++) { c=0; for(j=0;j<q;j++) { if(a[j]==r) ...
C
/* * Copyright (c) 2020, Cisco Systems, Inc. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://github.com/cisco/openosc/LICENSE */ #include <stdio.h...
C
//Eratosthenes_bits.c -- ʹEratosthenesɸѡ,λ鴢#include<stdio.h> #include"USE.h" #include<stdio.h> #ifdef USE_06_05 #define NUM 1000000 #define TRUE 0 #define FALSE 1 //ע,0,1ԼIJͬ void set_bits(char bit_array[], unsigned bit_number); int test_bits(char bit_array[], unsigned bit_number); int Eratosthenes(int num) { int co...
C
//Jamal Kharrat Section 1 // CS 350, Fall 2013 // Lab 2: Declaring, manipulating, and printing signed and unsigned integers of various lengths // // Illinois Institute of Technology, (c) 2013, James Sasaki #include <stdio.h> // to access printf, scanf #include <limits.h> int main() { printf("CS 350 Lab 2 for %s\n\n...
C
/* ** EPITECH PROJECT, 2019 ** wiewe ** File description: ** all little functions used on wiewer */ #include "my.h" #include "prototypes.h" #include "struct.h" #include "gnl.h" int have_space(char *str) { for (int i = 0; str[i] != '\0'; i++) { if (str[i] == ' ') return (0); } return (8...
C
//#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <locale.h> #include <string.h> #include "dataWorker.h" #include "shellsort.h" void parse_param(int argc, char * argv[]) { setlocale(LC_ALL, "Russian"); char in_path[256]; char out_path[256]; char symbols_path[256]; ...
C
#include <pthread.h> #include <stdio.h> #include <math.h> #include <stdlib.h> #include <semaphore.h> #include <unistd.h> #define RESET "\033[0m" #define YELLOW "\033[1;33m" #define GREEN "\033[1;32m" #define RED "\033[1;35m" #define BLUE "\033[1;36m" #define M 5 //Количество писателей #define N 10 //Количесвто чита...
C
#include "shutterctl.h" #include "timer.h" #include "eepdata.h" #include <avr/io.h> #define shutter_stop() do { PORTA &= ~(_BV(PA6) | _BV(PA7)); } while (0) #define shutter_up() do { PORTA |= _BV(PA6); } while (0) #define shutter_down() do { PORTA |= _BV(PA7); } while (0) static timer shutterTimer; static timer dela...
C
#include "op.h" void define_ops(t_op ops[NBR_OP]) { ops[0].t_fun_addr = &add; ops[0].operator = '+'; ops[1].t_fun_addr = &sub; ops[1].operator = '-'; ops[2].t_fun_addr = &mul; ops[2].operator = '*'; ops[3].t_fun_addr = &div; ops[3].operator = '/'; ops[4].t_fun_addr = &mod; ops[4].operator = '%'; } t_op_ptr ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* flag_searcher.c :+: :+: :+: ...
C
/********************************************** * File: factDbl.c * Author: Matthew Morrison * Email: matt.morrison@nd.edu * * Calculates the factorial of an input value **********************************************/ #include <stdio.h> #include "Recurse.h" int main(){ unsigned int factVal = GetValidUI...
C
//Includes and Global Variables: #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <ext2fs/ext2_fs.h> #include <string.h> #include <libgen.h> #include <sys/stat.h> #include "type.h" MINODE minode[NMINODE]; MINODE *root; PROC proc[NPROC], *running; int dev; int nblocks; int ninodes; int bmap; int ...
C
#include "/d/dagger/aketon/short.h" inherit VAULT; void create() { ::create(); set_property("light",2); set_property("indoors",1); set_short("An elven house of Aketon"); set_long("%^GREEN%^An elven house of Aketon%^RESET%^\n"+ "You are standing in the living room of a tastefully decorated elven"+ ...
C
#include <stdio.h> int calc(int, int); int compars(char*, char*); int length(char *); int main(int argc,char** argv){ char *ville[11]= {"Brest","Grenoble","Lille","Lyon","Marseille","Nantes","Paris","Rennes","Rouen","Strasbourg","Toulouse"}; int ville1 = 0, ville2=0; if(3 != argc){ printf("Nombre de param...
C
#include <stdio.h> #include <stdlib.h> int sumdigit(int); int main(int argc, char *argv[]) { int n; n = atoi(*(argv+1)); printf("The sum of the digits of %d = %d\n",n,sumdigit(n)); return 0; } int sumdigit(int n) { int sum=0,rem; while(n > 0) { rem = n%10; sum += rem; n /= 10; } return sum; }
C
#define _POSIX_C_SOURCE 200809L #include "ProtocolS.h" #include <string.h> #include <stdio.h> #include <stdlib.h> #include <arpa/inet.h> #define ERROR 1 #define OK 0 #define SOCKET_CLOSED 2 void protocolS_init(protocolS_t *self, int fd) { socketC_setFd(& self -> peerSocket, fd); } int protocolS_receive(protocolS_...
C
#include <stdio.h> int* sum(int a, int b); int main(void) { int* resp; // resp = sum(10, 20); // Լ ޾Ƶ̴ ڵ printf(" : %d\n", *resp); return 0; } int* sum(int a, int b) { int res; // static res res = a + b; return &res; // res ּҰ ( ִ ּҰ ) }
C
#ifndef __SEMANTIC_PHASE10_H__INCLUDED__ #define __SEMANTIC_PHASE10_H__INCLUDED__ /* SEMANTIC PHASE 10 * * This declares the functions that are used to perform "phase 10" of the * semantic work for HWC: this converts the parse tree into a set of * internal HWC objects; this phase focuses on name resolution. */ ...
C
#include "stdlib.h" #include "stdint.h" #include "stdio.h" #include "limits.h" #include "string.h" int main() { printf("Implicit Test:\n"); printf("Test int INT32_MAX to short conversion with value loss\n"); int a=INT32_MAX; short c=a; printf("Test int to char\n"); char chc=a; printf("Test implicit long l...
C
/* * Copyright 2011 Colomban Wendling <ban@herbesfolles.org> * * This program 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 2 of the License, or * (at your option) any later version. *...
C
/*Volume of prism*/ #include <stdio.h> void main(){ float b,h1,h2,vol,area; b = 5; h1 = 5; //base triangle height h2 = 5; //prism height /*printf("Enter the base length of triangle>> "); scanf("%f",&b); printf("Enter the base height of triangle>> "); scanf("...
C
#include <func.h> void sigFunc(int signum,siginfo_t *p,void *p1){ sleep(5); } int main(int argc,char* argv[]){ sigset_t mask; sigemptyset(&mask); sigfillset(&mask); // 防止所有信号触及关键代码 int ret=sigprocmask(SIG_BLOCK,&mask,NULL); ERROR_CHECK(ret,-1,"sigprocmask"); struct sigaction act; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strncmp.c :+: :+: :+: ...
C
#include <winsock2.h> #include <stdio.h> #include <stdlib.h> #pragma comment(lib, "ws2_32.lib") int envoie(char paquet[]) { WSADATA WSAData; SOCKET sock; SOCKET csock; SOCKADDR_IN sin; SOCKADDR_IN csin; int sinsize = sizeof(csin); WSAStartup(MAKEWORD(2, 0), &WSAData); sock = socket(AF_...
C
#include<stdio.h> #include<math.h> int i=0; int f(int x) { int s=1; for(i=0; i<x; i++) s*=i+1; return s; } int binomial(int n, int k, int type) { if(type == 1) { return f(n)/(f(k)*f(n-k)); } else if(type == 2) { int s=1; for(i=0; i<k; i++...
C
#include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> int main(void){ int req; int ans; int n1 = 0, n2 = 0; do { req=open("/tmp/fifo_req",O_WRONLY); if (req==-1) sleep(1); } while (req==-1)...
C
# include <stdio.h> # include <stdlib.h> # include <string.h> # include <err.h> # include "../headers/analysis.h" # include "../headers/encode.h" const char *alpha_ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"; //----------------------------------------------------------------------------- // ...
C
#include <stdio.h> static void swap (int nums[], int i, int j); static void prettyPrint (int nums[], int length); static void shuffle (int nums[], int length); static void sort (int nums[], int low, int high); static void insertion_sort (int nums[], int low, int high); void quicksort (int nums[], int length); int ma...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> int fib(int n){ int next_reuslt; int pre_result = 1; int result = 1; while (n > 2){ n -= 1; next_reuslt = pre_result; pre_result = result; result = next_reuslt + pre_result; } return result; } int main(){ int f,n=0; printf("ڼ쳲:"); ...
C
#include "led.h" //ʼPE0PE2Ϊ.ʹڵʱ //LED IOʼ void LED_Init(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOE, ENABLE); //ʹPE˿ʱ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_2; //LED0-->PE.0 ˿ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; ...
C
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int ar[n]; for(int i=0;i<n;i++) cin>>ar[i]; int jump=0; int i=0; while(i<n) { if(ar[i+2]==0) { jump++; i=i+2; } else if(ar[i+1]==0) { ...
C
#include <stdio.h> #include <stdlib.h> #include <limits.h> #include "utils.h" //INT_MAXを新しく確保した配列の最後に入れる int *appendMax(int ary[], int size) { int *p;//新しく確保した配列の先頭アドレス //ここにコードを書く p = (int*) malloc((size + 1) * sizeof(int)); int i; for (i =0; i < size+1; i++) { if (i != size) p[i] = ary[i]; else p[...
C
#include <stdio.h> void non_ref(int i) { printf("non_ref: %016x\n", &i); printf(" : %d\n", i); // 値を使うとき } void ref(int *pi) { printf("ref: %016x\n", pi); printf(" : %d\n", *pi); // 値を使うとき } int main() { // int i = 10; // printf("base: %016x\n", &i); printf(" : %d\n", i); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* separate_lines.c :+: :+: :+: ...
C
#include <CL/cl.h> #include <stdio.h> #include <string.h> #include <malloc.h> int main() { cl_platform_id *platform; cl_uint num_platform; cl_int err; err = clGetPlatformIDs(0,NULL,&num_platform); platform =(cl_platform_id *)malloc(sizeof(cl_platform_id)*num_platform); err = clGetPlatformIDs(num_platform,platfor...
C
#include <stdio.h> //Add vectors in sum notation and multiply vectors in p-adic notation in GR(9,2) where xi satisfies the monic irreducible //x^2 +4x+8 int mult(int (*x)[2], int (*y)[2], int (*z)[2], int *** a){ int i,j; int w[1][2]; if(x[0][0] == 8 || x[0][1] == 8 || y[0][1] == 8 || y[0][0] == 8){ if(x[0]...
C
#include "cpfphig/cpfphig.h" #include "cpfphig/list.h" #include "cpfphig/unit/mock/list_mock.h" #include "cpfphig/malloc.h" #include "cpfphig/free.h" #include <stdarg.h> #include <stddef.h> #include <setjmp.h> #include <cmocka.h> #include <stdio.h> static void arguments( void** state ) { int ...
C
/* * (C) Jack Hay, Apr 2021 */ #ifndef _DISPLAY_DISPLAY_H #define _DISPLAY_DISPLAY_H #include <stdint.h> #include <stddef.h> #define DISPLAY_WIDTH 512 #define DISPLAY_HEIGHT 384 /** * Initialize the display */ void init_display(); /** * Clear the screen */ void clear_screen(); /** * Write a message to the ...
C
#include <stdio.h> #include <stdlib.h> typedef struct node { char *data; struct node *next; } node; void printList(node *head){ node *current = head; for(;current !=NULL;current = current->next){ printf("%s \n",current->data); } } int main(){ node *first = NULL; node second={"first",NULL}; first = (node...
C
/* Copyright (c) 2016 Qualcomm Technologies International, Ltd. */ /* %%version */ /** * \file * Header with definitions for streaming data buffers. */ #ifndef BUFFER_MSG_H #define BUFFER_MSG_H #include "buffer/buffer.h" /* Use #ifdef to allow this to be overridden in config file */ #ifndef BUFFER_MSG_RING_SIZE...
C
#include <stdio.h> /** * main - Entry point * * Return: Always 0 (Success) */ int main(void) { long int i, ant = 1, act = 2, buff; printf("1, 2, "); for (i = 2; i <= 49; i++) { buff = ant + act; ant = act; act = buff; if (i != 49) printf("%ld, ", buff); else printf("%ld\n", buff); } return ...
C
/* 用 C 语言实现一个简易的计算器: - 两个数字之间的加,减,乘,除 */ #include <stdio.h> int main() { double number1=0.0; double number2=0.0; char operation; // 获取用户输入的计算表达式 printf("\nPlease input your number and operation:\n"); scanf("%lf%c%lf", &number1, &operation, &number2); switch (operation) { ...