language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#ifndef RASTER_IMAGE_H #define RASTER_IMAGE_H typedef enum ImageFileType { kUnknownType = -1, kTGA_COLOR, // 24-bit color image kTGA_GRAY, kPPM, // 24-bit color image kPGM // 8-bit gray-level image } ImageFileType; /** This is the enum type that refers to images loaded in memory, whether * they were read from ...
C
// // main.c // no4_2 // // Created by 谢容海 on 2020/6/11. // Copyright © 2020 谢容海. All rights reserved. // /** 8. RLE压缩解压算法 涉及知识点:文件读写、位操作、内存管理、结构体定义、RLE算法、命令行参数 要求: 编写一个程序,可以在命令行输入参数,完成指定文件的压缩解压 命令行参数如下 rle file1 –c(-d) file2 第一个参数为可执行程序名称,第二个参数为原始文件名,第三个参数为压缩或解压缩选项,第四个参数为新文件名 */ #include <stdio.h> #in...
C
#pragma once #include "../utils/vector.h" //===========================VECTORINT FUC DEFINITONS========================== //mallocs a new vectorInt vectorInt* createVectorInt(int size) { vectorInt *p = NULL; p = (vectorInt*) malloc(sizeof(vectorInt)); p->numelems = 0; p->capacity = size; p->arr = (...
C
#define _GNU_SOURCE #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #define SEP "##########" typedef struct { char *text; int line; void *next; } line_list; line_list * list_add (line_list * llist, char *text, int line) { line_list * ll= malloc(sizeof(line_list)); ll->text = strd...
C
/* * Copyright (C) Sony Computer Entertainment America LLC. * All Rights Reserved. */ #ifndef SCE_SLEDMEMORY_H #define SCE_SLEDMEMORY_H #include "target_macros.h" #include "base_types.h" #include <stddef.h> // for size_t /// @brief /// A #define to be included in a class to provide placement new functiona...
C
/** Author : Mehul completed - modified given assignment code do_system - execute with system() do_exec - create child process usign fork, execv and exectue command in child - wait for child to complete in parent - get exit status do_exec_redirect -same like do_exec, redirect standard out to a file specified ...
C
#include "stack.h" #include "converter.h" #include<stdlib.h> #include<string.h> #include<ctype.h> //연산자의 우선순위에 따른 값 반환 //* / 3 //+ - 2 // ( 1 int OpToNum(char op){ int prior; switch(op){ case '*': case '/': return 3; case '+': case '-': return 2; case '(': return 0; default : break; } r...
C
#include <stdio.h> void main() { char *name = (char*)malloc(strlen("Susan")+1); strcpy(name, "Susan"); while(*name != 0) { printf("%c", *name); name++ } }
C
#include <unistd.h> #include <errno.h> #include <signal.h> #include <stdio.h> #include <string.h> void signal_recibido(int s) { char buf[256]; sprintf(buf, "Ha llegado signal SIGINT\n"); write(1,buf,strlen(buf)); } main(){ char c; int ret; char buffer[1024]; signal(SIGINT,signal_recibido); ret=read(0,&c,size...
C
#include <stdio.h> #include <limits.h> #if CHAR_BIT != 8 #error CHAR_BIT MUST BE 8 #endif extern unsigned int timings[256]; extern void leak(); int main() { int i; /* Test specpoline */ leak(); /* Show results */ for (i = 0; i < 256; i++) { if (i % 16 == 0) printf("...
C
#include <stdio.h> #include <unistd.h> int main(int argc, char **argv) { int max,min; int get; char str[10]; FILE* pFile; int flag = 0; pFile = fopen((argv[1]),"r+"); while((fscanf(pFile,"%d%s\n",&get,str)) != EOF) { if(get >= max) { max = get; if(get >= min && flag == 0) { min = get; ...
C
#include <stdint.h> #ifndef _APATYPES_H_ #define _APATYPES_H_ #define NULL 0 typedef uint32_t u32_t; typedef int32_t s32_t; typedef uint16_t u16_t; typedef int16_t s16_t; typedef int8_t s8_t; typedef uint8_t u8_t; #define TRUE ((bool_t)1) #define FALSE ((bool_t)0) #define HIGH 1 #define LOW 0 typedef uint8_t tm_u8_t;...
C
//************************************************************************************ //Estimated time spent ~ 7 hours //File: quicksort.h //Assignment: Homework 4 //Author: Mahesh Gautam //Date: Spring 2016 //Description: This program takes in a input file containing fractions via command line //argument, sorts them,...
C
#pragma once #include <stdbool.h> //Nondeterministic automaton // Structs typedef struct { unsigned int to; //Don't need 'from' since going to be stored inside States char character; }Transition; typedef struct { unsigned int id; bool terminal; //By convention, state will be considered initi...
C
/* * Discription:Program to implement hashing * Author:Nooras Fatima-16co01 * Created on:Oct 5,2017 */ #include<stdio.h> #include<math.h> #define MAX_SIZE 5 int hash(int n) { return n%MAX_SIZE; } int linear_probe(int h) { return ++h%MAX_SIZE; } int quadratic_probe(int h,int i) { return (int)(h+pow(i,2))%MAX_SIZ...
C
/** * * @file IGV5BoneBatch.h * * @brief Handles a batch of bones. Most time application programmer don't use this directly * * @author Charles Shih-I Yeh * */ #ifndef _IGV5BONEBATCH_H_ #define _IGV5BONEBATCH_H_ #include "IGV5Vertex.h" #ifdef __cplusplus extern "C" { #endif /*!****...
C
#ifndef SHIM_CURL_H #define SHIM_CURL_H typedef enum simple_http_request_method { GET, POST, PUT, UPDATE, DELETE } Method; typedef struct simple_http_request { Method method; char * url; char ** headers; int num_headers; char * bytes; int num_bytes; }...
C
#include <math.h> //size of history buffer // #define HBSIZE 32 //size of Pattern history table // #define PHTSIZE 4294967295 //2^HBSIZE - 1 #define PHTSIZE 8191 // extern unsigned int PHT[PHTSIZE]; unsigned int PHT[PHTSIZE]; // extern unsigned int HB; unsigned int HB; void init_predictor () { //initialize Hist...
C
/* ** EPITECH PROJECT, 2019 ** my compute square root ** File description: ** returns the quare root of a number */ int my_compute_square_root(int nb) { int root = 0; while ((root * root) != nb) { if (root > 46340) return (0); root++; } return root; }
C
#include <stdio.h> #include <stdlib.h> #include "func_array.h" #include "func.h" /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) { int TrianglesNumber, i; int A_x, A_y, B_x, B_y, C_x, C_y; printf("Enter TrianglesNumb...
C
/* Kenneth Bicknell 12/04/2019 assignment 7 : magical hats Mostly sudoku.c from Prof. Meade */ #include <stdio.h> #include <stdlib.h> #define TRUE (1==1) #define FALSE (1==0) #define EMPTY 0 #define OPTIONS 3 int ** solvedBoard; int *** unsolvedBoard; int size; void createBoards(); void readBoar...
C
#include <stdio.h> #include <gl.h> #include <math.h> #include "rasterizer.h" #include "connection.h" static const int32_t DISPLAY_WIDTH = XMAXSCREEN + 1; static const int32_t DISPLAY_HEIGHT = YMAXSCREEN + 1; static int save_file_frame_number = 0; static int save_file_last_frame = 1 << 30; static char *save_filename =...
C
// if a number is equal to the sum of all digits cube of a number is same as the number is called Armstrong number. // 153 is a Armstrong number. #include <stdio.h> // If reverse of a number is same as the number is called palindrome number main(){ int number; int remainder; int quotient; int result=...
C
typedef VRType ShortPathTable[ MAX_VERTEX_NUM ]; //̾,һά typedef bool PathMatrix[ MAX_VERTEX_NUM ][ MAX_VERTEX_NUM ]; //·,ά void ShortestPath_DIJ(MGraph G,int v0,PathMatrix p,ShortPathTable D) { //Dijkstra㷨Ķv0ඥv·p[v]ȨD[v] //p[v][w]Ϊtrue,wǴv0vǰ·ϵĶ //final[v]Ϊtrue,Ѿôv0v· ...
C
/** * \file * \brief This is the implementation module of the Shell console * * This interface file is used for a console and terminal. * That way we can interact with the target and change settings using a shell implementation */ #include "Shell.h" #include "CLS1.h" #include "FRTOS1.h" #include <string.h> /* for...
C
// ############################ // EULER PATH AND TOUR CHECKING // ############################ // Check whether graph has an Euler path. // Euler path = connected + v,w has odd degree // (graph is assumed to be connected) // Complexity = Linear O(v) int hasEulerPath(Graph g, Vertex v, Vertex w) { int t = degree(g,v)...
C
/* * MAGIC2.C: * * Additional user routines dealing with magic spells. * * Copyright (C) 1991, 1992, 1993 Brett J. Vickers * */ #include "mstruct.h" #include "mextern.h" /**********************************************************************/ /* vigor ( ȸ ) */ /*************...
C
/*this is my asssignment on pset 2 done by Gautham M in summer 2016 */#include<cs50.h> #include<stdio.h> #include<ctype.h> #include<string.h> int main(int argc,string argv[]){ string s; if(argc!=2) {printf("wrong input"); return 1;} else { int k = atoi(argv[1]); ...
C
#include "q_incs.h" #include "qsort_asc_F8.h" #include "approx_quantile.h" #include "determine_b_k.h" #include "New.h" #include "Collapse.h" #include "slow_output.h" int approx_quantile_make( int num_quantiles, uint64_t n_input_vals_estimate, approx_quantile_state_t *ptr_state, double eps, int *pt...
C
#include<stdio.h> int main() { int a[200],n,i; printf("\n Enter no. of elements : "); scanf("%d",&n); printf("\n Enter array : "); for(i=0;i<n;i++) { scanf("%d",&a[i]); } int temp,j; for(i=0;i<n-1;i++) { for(j=i+1;j<n;j++) { if(...
C
#include "syscall.h" #include "test_utility.h" int main() { int res0 = Create("file1",10); int res1 = Create("file2",10); int res2 = Create("file3",10); int res3 = Create("file4",10); int res4 = Create("file5",10); int res5 = Create("file6",10); int res6 = Create("file7",10); int res7 = ...
C
//Instruction types #define INSTR_STOP 0 #define INSTR_SPEED 1 #define INSTR_FORWARD 2 #define INSTR_BACK 3 #define INSTR_RIGHT 4 #define INSTR_LEFT 5 #define INSTR_ROT_R 6 #define INSTR_ROT_L 7 #define INSTR_LED 9 //Increase this number if more are added #define NUMBER_OF_INSTRUCTIONS 10 //Respo...
C
#include <string.h> #include <stdio.h> #include <stdlib.h> #include "../libft.h" int main(void) { char *n = "\t\v\f\r\n \f-06050"; int i1 = atoi(n); int i2 = ft_atoi(n); printf("%d\n", i1); printf("%d\n", i2); }
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #define MAX 100 int buffer[MAX]; int counter = 0; pthread_mutex_t the_mutex; pthread_cond_t condc; pthread_cond_t condp; void * producer(void * ptr) { while(MAX == MAX) { pthread_mutex_lock(&the_mutex); printf("Producer activates\...
C
/*PROGFH4 - Program to read from file*/ /*Authors: Asmit De, Shinjini Basu Date: 16.11.2009*/ #include <stdio.h> #include <conio.h> void main() { FILE *fp; char name[20]; clrscr(); fp=fopen("H:\\XIE2008\\myfile2.txt","r"); if(fp==NULL) { printf("\nFile opening error.....press any ...
C
#include <stdio.h> #include <stdlib.h> void main() { int i, NUM[5]; //lendo os valores for (i=0; i<5; i++) { printf("Informe um numero: "); scanf("%d", &NUM[i]); }//imprimindo os valores for (i=0; i<5; i++) printf("Numero: %d \n", NUM[i]); }
C
/** * @Author Joshua Standiford (jstand1@umbc.edu) * @E-mail jstand1@umbc.edu * This file is used to test minesweeper.c. * This file will test edge cases, boundary issues, * concurrency issues and if the game breaks under * extreme conditions. */ #define _BSD_SOURCE //For usleep #include <fcntl.h> #include <pthr...
C
#pragma once #include "../qcgc.h" #include <stdlib.h> #include "arena.h" #define DECLARE_BAG(name, type) \ typedef struct name##_s { \ size_t size; \ size_t count; \ type items[]; \ } name##_t; \ \ __attribute__ (...
C
#include <stdio.h> void exercice9() { for(int i = 20; i > -1; i--) { printf("%d\n", i); } }
C
// Matrix addition, CPU version // gcc matrix_cpu.c -o matrix_cpu -std=c99 #include <stdio.h> #include <stdlib.h> #include "milli.h" void add_matrix(float *a, float *b, float *c, int N) { int index; for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) { index = i + j*N; c[index] = a[index] + b[index];...
C
#include <stdio.h> #include <stdlib.h> #include "tools.h" #include "menu.h" #include "calendar.h" #include "database.h" #include "datastructure.h" int main() { const char *mainMenuTitle = "Terminverwaltung V 1337"; const char *mainMenu[] = { "1. Neuen Termin anlegen", ...
C
// Client side C/C++ program to demonstrate Socket programming #include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> #include <unistd.h> #include <string.h> #include <mutex> #define PORT 13000 std::mutex mtx; void Device_Read(int sock) { char buffer[1024] = {0}; int valread = read( sock , buffer, 1024);...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include "BMPconfig.h" #define FORMAT_SIZE 68 FILE *fp; void undoColor(); void setBackColor(int,int,int); void getBMP(FILE *fp,BMPINFOHEADER *info,RGBQUAD *buf) ; void move(int x,int y); int main(void) { uint16_t i; BYTE *buf ; BMPFILEHEADER file; ...
C
#include "random.h" /* Copyright Numerical Recipes in C */ double ran0(long *idum) { long k; double ans; *idum ^= MASK; k=(*idum)/IQ; *idum=IA*(*idum-k*IQ)-IR*k; if (*idum < 0) *idum += IM; ans=AM*(*idum); *idum ^= MASK; return ans; }
C
#include "userprog/syscall.h" #include <stdio.h> #include <syscall-nr.h> #include "threads/interrupt.h" #include "threads/thread.h" #include "lib/user/syscall.h" #include "threads/vaddr.h" #include "lib/kernel/console.h" #include "filesys/file.h" #include "filesys/filesys.h" #include "vm/page.h" #include "lib/kernel/...
C
static char help[] = "Trajectory sensitivity of a hybrid system with state-dependent switchings.\n"; /* The dynamics is described by the ODE u_t = A_i u where A_1 = [ 1 -100 10 1 ], A_2 = [ 1 10 -100 1 ]. The index i changes from 1 to 2 when u[1]=2...
C
/* * 007spi_txonly_arduino.c * * Created on: 24 May 2020 * Author: MAT */ #include "stm32f407xx.h" // PB15 -> MOSI // PB14 -> MISO // PB13 -> SCLK // PB12 -> NSS // ALT FUN -> Mode 5 void SPI2_GPIOInits(void) { GPIO_Handle_t SPIPins; SPIPins.pGPIOx = GPIOB; SPIPins.GPIO_PinConfig.GPIO_PinMode = GPIO_...
C
/* * nombre: ejercicio.c * descripción: * fecha: 27/03/2018 */ #include <stdio.h> #include <string.h> struct corredor{ char nombre[20]; int edad; char sexo[20]; char club[20]; char categoria[20]; }corredor1; int main() { printf("Digite su nombre: "); scanf("%s",corredor1.nombre); printf("Digite su edad:...
C
#include <stdio.h> #include <stdlib.h> //Declarao de #define #define TAM 20 //Declarao de Prototipo das Funes void criaS1(char S[], int quant); int main() { int i; char string[TAM]; printf("\n\tInforme a frase: "); gets(string); criaS1(string,TAM); } //Funes void criaS1(char S[], int quant) { int i, j...
C
/* * vectors.c * * Created on: Feb 1, 2013 * Author: ruckus */ #include "vectors.h" void rotate_y(Vector3f *vector, float degree) { // | cos 0 sin | // rot_y = | 0 1 0 | // | -sin 0 cos | float rad = degree * M_PI/180.0; float x = vector->x * cosf(rad) + vector->z * sinf(rad); f...
C
#include "stdio.h" #include "stdlib.h" void swap(int *a,int *b) { int t=*a; *a=*b; *b=t; } int partition(int a[],int low,int high,int n) { int p = a[high]; int i= low-1,j; for(j=low;j<=high-1;++j) { if(a[j]<=p) { i++; swap(&a[i],&a[j]); } } swap(&a[i+1],&a[high]); return i+1; } void quickSort(...
C
#include<stdio.h> #include<stdlib.h> #include <time.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> #include <aio.h> int COUNT = 0; void readPrep(struct aiocb* block, int offset, off_t TransferLength); void writePrep(struct a...
C
#include "hello-print.h" /** * This example shows how to use custom libraries and * compile them using GCC. * * Based on http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/ * * gcc -o hello-make hello-make.c hello-print.c -I. * ./hello-make * * The -I. is included so that gcc will look in the ...
C
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <arpa/inet.h> #include <errno.h> typedef struct sockaddr *sad; /* A necesary dummy typedef */ #define PORT 48006 int main() { int sock; /* Socket that will be bind */ struct sockaddr_in sin; /* Address Structure */ /*...
C
#include <stdlib.h> #include <stdio.h> #include "lists.h" /** * reverse_listint - reverses a listint_t list * @head: pointer to head pointer of the list * Return: head of reversed list **/ listint_t *reverse_listint(listint_t **head) { listint_t *prev, *current; listint_t *next; if (*head == NULL) return (NULL)...
C
#include "../inc/query_hashtable.h" #include <string.h> #include <stdio.h> int init_space_hash(void *s, unsigned long size, space_t *space, unsigned int arg) { int i; space->hash_itme_count = HASH_ITME_COUNT; space->hash = (struct hlist_head *)( s + size - (space->hash_itme_count) * sizeof(struct hlist_head)); p...
C
/* ПРИМЕР: A = 0 DO WHILE A < 0 A = A + 1 PRINT A LOOP */ #define DO 228 #define LOOP 229 #define UNTIL 230 #define WHILE 231 struct commands table[16] = { ... {"do", DO}, {"loop", LOOP}, {"until", UNTIL}, {"while", WHILE}, ... {"", END} /* Маркер конца таблицы...
C
#include "threads.h" #include <stdlib.h> #include <pthread.h> #include <time.h> #include <string.h> #include <stdbool.h> #include <unistd.h> #include "logger.h" #include "utils.h" #include "main.h" void reader_read(int divider); void writer_write(); pthread_mutex_t readers_waiting_mutex = PTHREAD_MUTEX_INITIALIZER...
C
/* ** main.c for main in /home/uberti_l/rendu/104intersection ** ** Made by louis-emile uberti-ares ** Login <uberti_l@epitech.net> ** ** Started on Mon Dec 14 10:03:52 2015 louis-emile uberti-ares ** Last update Fri Dec 25 16:10:42 2015 louis-emile uberti-ares */ #include <stdio.h> #include <stdlib.h> #include <ma...
C
/** * Name: Charles Cash * Date: September 28, 2016 * Class: COP 2220 * Assignment: Circle, Square, Triangle, and Rectangle */ #include <stdio.h> #include <math.h> /** * Prints the initial output to direct the user */ int initOutput(void){ printf("This program will compute the area and perimeter of the selected geo...
C
#include <stdio.h> int main () { double salario, salarionovo, gasto=0; scanf("%lf", &salario); while (salario >= 0) { if (salario < 500) { salarionovo = salario*1.15; gasto = gasto + (salarionovo - salario); } else if (salario >= 500 && salario <= 1000) { ...
C
#include <stdio.h> #include <stdlib.h> int main() { int m,n,o=1; long long int p; float a,b; char x; while(1) { system("clear"); printf("*************CALCULATOR*************\n"); printf("\nEnter (a) for Addition (A+B)\nEnter (s) for Subtraction (A-B)\nEnter (m) for Mu...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
/* ** NAME ** out_line -- compute means of output buffer and write to output file ** ** SYNOPSIS ** void ** out_line (fdo, obuf, sums, npix, o_nsamps, nbands, ztype) ** int fdo; ** fpixel_t *obuf; ** double *sums; ** int *npix; ** int o_nsamps; ** int nbands; ** int ztype; ** ** DESCRIPTION ** out_line computes the...
C
#include <stdio.h> int N = 3; void print_edjes(int matrix[N][N], int, int); int main() { int n; scanf("%d", &n); N = n; int matrix[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { scanf("%d", &matrix[i][j]); } } print_edjes(matrix, n, 0); ...
C
#include <stdio.h> #include <string.h> #include <errno.h> #include <unistd.h> #include <fcntl.h> int main(void) { int fd, i; /* 根据书中3.11小节的描述,使用 O_APPEND 标志打开的文件,将会把 "position * to the end of file and write" 作为一个原子操作,在每次写入之前,都会把 * "current file offset"设为文件末尾,写入之后,也会增大文件的size,这样, * 即使是多个进程同时读写一个文件,也能保证它们之间的写入操...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> struct node { int info; char naam[20]; struct node *ptr; }*front,*rear,*temp,*front1,*song,*f2; int frontelement(); void enq(); void deq(); void empty(); void display(); void create(); void queuesize(); void shuffle(); void songs(); void create() ...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> int main(){ // FILE *f = fopen("carlos.txt", "w"); // char a[20] = "teste"; // fwrite("teste",sizeof(a),1,f); // fclose(f); // FILE *f1 = fopen("carlos.txt", "r"); // char teste[20]; // fread(&teste, sizeof(teste), 1, f1); // fclo...
C
#ifndef __http_request_h__ #define __http_request_h__ #include "input_buffer.h" #include "picohttpparser.h" #define NUM_HEADERS 100 typedef struct HttpRequest { const char *method; size_t method_len; const char *path; size_t path_len; int minor_version; struct phr_header headers[NUM_HEADERS]; size_t...
C
/******************* *Kaleb Spraker *CPSC 1020 001, F18 *ksprake@clemson.edu ********************/ //This project takes an image that I provide and resizes the image, mirrors it, //and changes the color of that image to gray. It then outputs a collage of //the old and new image. #include <stdio.h> #include <stdlib.h>...
C
#include "../header/common_header.h" #include "../header/login_header.h" #include "../header/kdc_crypto_header.h" // check if username and hash of password is legit or not int check_username_and_password_hash(char * username, unsigned char * digest) { FILE * fp = fopen("database/registration_database.txt", "r"); //...
C
#include<stdio.h> void main() { int n, sum=0; printf("ENTER THE NUMBER\n"); scanf("%d",&n); while(n!=-1) { if(n>0) { sum=sum+n; } printf("ENTER THE NUMBER \n"); scanf("%d",&n); } printf("THE TOTAL SUM IS %d",sum); }
C
#include<stdio.h> #include<sys/stat.h> #include<stdlib.h> int main(int argc,char* argv[]) { struct stat sb; char *linkname; ssize_t r; char buf[100]; r = readlink("/usr/bin/play", buf, sizeof(buf)); #if 0 if (argc != 2) { fprintf(stderr,"Usage: %s <pathname>\n",argv[0]); ex...
C
#include "mutex.h" int cmutex_init(t_cmutex *ptr_mutex) { #ifdef __linux__ *ptr_mutex = (t_cmutex)PTHREAD_MUTEX_INITIALIZER; return (0); #elif _WIN32 *ptr_mutex = CreateMutex(NULL, FALSE, NULL); if (*ptr_mutex == NULL) return (1); return (0); #endif } int cmutex_lock(t_cmutex *ptr_mutex) { #ifdef __linu...
C
int main() { //bool func(char* c) { // if ((*c == '+' || *c == '-' || *c == '*' || *c == '/') && *(c + 1) == '\0') { // return false; // } // return true; //} //int returnNum(int a, int b, char c) { // if (c == '+') { // return a + b; // } // e...
C
#include<stdio.h> int main() { int temp; printf("Enter the value: "); scanf("%d",&temp); if(temp>50) { printf("Invalid."); exit(0); } if(temp<30) { printf("Wear the down jacket 1"); } else { printf("No need to worry about the jacket"); } return 0; }
C
#include "./internal.h" VALUE rb_cTable; #define CHECK_DIMENSION(v) \ if (v < 1) { ...
C
/* Exercise 2-4: Write an alternate version of squeeze(s1,s2), that deletes each character in s1 that matches any character in the string s2. */ void squeeze(char[], char[]); int main(void){ char sample[] = "cagando e andando"; char toremove[] = "ag"; squeeze(sample, toremove); printf("%s\n"...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> long rand48(long x){ long result = ((((long)(25214903917*x) +11)) % ((long)pow(2,48))); return result; } long gen_java_inverse(long v1, long v2){ long w1 = v1 << 16; while(v2 != (rand48(w1) >> 16)){ w1++; } long w0 =0; while(((v1 != (rand48(w0) >> ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* aff_tab.c :+: :+: :+: ...
C
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: main.c * Autora: Xiana Carrera * * Data: 11 de novembro de 2019, 16:59 * Este programa le dúas cadeas de...
C
/** * \file fail_compare_unsigned_int_nully.c * * A null right hand side argument causes a model assertion. * * \copyright 2017 Velo Payments, Inc. All rights reserved. */ #include <stdlib.h> #include <cbmc/model_assert.h> #include <vpr/compare.h> unsigned int nondet_arg1(); int main(int argc, char* argv[]) {...
C
/* Copyright (c) Colorado School of Mines, 2010.*/ /* All rights reserved. */ /* UNI2TRI: $Revision: 1.4 $ ; $Date: 1997/07/29 16:00:34 $ */ #include "par.h" #include "triP.h" #include "tri.h" #include "sloth.h" /*********************** self documentation **********************/ char *sdoc[] = ...
C
#include<stdio.h> #include<stdlib.h> int main(){ int T, t; long sum = 0, k, *ni, *mi, i, mul; scanf("%d",&T); if (T<1 || T>1000) exit(0); for (t = 0; t<T; t++){ scanf("%ld",&k); sum += k; if (k<1 || k>100000 || sum > 500000) exit(0); ni = (long...
C
#include "DS3231.h" #include "i2c.h" #include "delay.h" #include "sys.h" _calendar_obj calendar; #define DS3231_WriteAddress 0xD0 #define DS3231_ReadAddress 0xD1 u8 BCD2HEX(u8 val) { u8 i; i= val&0x0f; val >>= 4; val &= 0x0f; val *= 10; i += val; return i; } u16 B_BCD...
C
/* * Copyright (C) 2017-2021 Lutz Ballaschke * * This 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.1 of the License, or (at your option) any later version. * * This software is di...
C
//----------------------------------------------------------------------------------------------------------- // Created by Evan Paul using sampleConcurrentServer.c as base code // 12/7/2019 // For CS 3377.0W1 Assignment 4 //-------------------------------------------------------------------------------------------...
C
#include<stdio.h> #include<stdlib.h> void inversion(double **A, int N) { double temp; int i, j, k; double **E = (double**)malloc(sizeof(double *) * N); for (i = 0; i < N; i++) E[i] = (double*)malloc(sizeof(double) * N); for (i = 0; i < N; i++) for (j = 0; j < N; j++) { ...
C
/** @file msgeq7.c * * @brief A description of the module's purpose. * * @par * COPYRIGHT NOTICE: (c) 2017 John Fritz * All rights reserved */ #include "msgeq7.h" /*! * @brief Get seven audio band levels from MSGEQ7 * @param[in] *audio Pointer to location to store data read from MSGEQ7 * @return void */ void msge...
C
#include <stdio.h> #include <stdlib.h> int is_palindromic(char value[], int value_len) { for (int i = 0, j = value_len - 1; i < value_len; i++, j--) { if (value[i] != value[j]) { return 0; } } return 1; } void reverse(char value[], char reversed[], int value_len) { ...
C
#include <stdio.h> /* * Programa de testes dos tipos e tamanhos */ void main (void){ int vazio[5]; int vetor[] = { 1, 2, 3 }; //quantidade de elementos printf("%d\n", sizeof(vazio) / 4); printf("%d\n", sizeof(vetor) / 4); }
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <assert.h> #include <inttypes.h> #include "teller.h" #include "account.h" #include "account.c" #include "error.h" #include "branch.h" #include "debug.h" void acc_branch(int func(sem_t *__sem), Bank* bank, Account* account, int branchID){ func(&(acc...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sort_args.c :+: :+: :+: ...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* oper_rotates.c :+: :+: :+: ...
C
/*You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap years, twen...
C
// // Created by Arnau Cirera on 01/05/2020. // #include "dyn_app_motor.h" #include "dyn/dyn_frames.h" #include "dyn/dyn_instr.h" bool direction_backward; //Declarem un boleà que indiqui la direcció que volem (true: endavant, false: endarrere) uint8_t motor_L; //Definim la variable d'un byte que contindrà el valor de...
C
/* * A simple SMB Direct client ... * */ #include <errno.h> #include <netdb.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/epoll.h> #include <sys/socket.h> #include <sys/types.h> #include <unistd.h> #include <rdma/rdma_cma.h> #include "event_loop.h" #include "message.h" #include "uti...
C
#include "socket.h" char toUpper(char ch) { #if 1 if(ch>=97&&ch<=122) return ch-32; #endif return ch; } st_socketConfigType gsocketconfig= { .domain=AF_UNIX, .stream=SOCK_DGRAM, .protocol=0, }; int main() { int clientFd; /* *** create socket */ int socketFd=socket(gsocketconfig.domain,gsocketconfig.s...
C
/* Queston link -->https://codeforces.com/problemset/problem/758/A <---*/ #include<bits/stdc++.h> #define ll long long #include <string> using namespace std; int main() { int n; cin >> n; int arr[100]; for(int i = 0;i < n;i++){ cin >> arr[i]; } int arrmax = arr[0]; for(int i = 1;i <...