language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include<stdio.h> void main() { int a=5; int b=++a; int x=a+b; //int x=a+(++a); printf("a=%d\n",a); printf("x=%d",x); }
C
/************************************************************************* > File Name: server_udp.c > Author: Arwen > Mail:745529725@qq.com > Created Time: Tue 24 Feb 2015 02:44:12 PM CST ************************************************************************/ #include<stdio.h> #include<stdlib.h> #include<stri...
C
#include "../includes/common.h" ElfW(Addr) GetSymAddr(const char *name, Elf_t *target) { ElfW(Sym) *symtab; char *SymStrTable; int i, j, symcount; for (i = 0; i < target->ehdr->e_shnum; i++) if (target->shdr[i].sh_type == SHT_SYMTAB || target->shdr[i].sh_type == SHT_DYN...
C
#include <stdio.h> void main(){ int x=0,y=10; for(x=0;y<20;x++,y++){ x=x+y; x++; printf("sum of x,y = %d\n",x); } printf("sum of x,y = %d\n",x); }
C
#include <stdio.h> float celsiusToFahr(float celsius); int main(){ float fahr, celsius; for(celsius = 0; celsius <= 300; celsius = celsius + 20) { fahr = celsiusToFahr(celsius); printf("%6.1f\t%6.1f\n", celsius, fahr); } } float celsiusToFahr(float celsius) { return celsius * 9....
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #include <time.h> #include <errno.h> #ifndef N #define N 16 #endif // #define COUNT_OPERATIONS // #define PRINT_RESULT extern void *permute0_func(void *arg); extern void permute0(int a[], int n, int conflictMap[N][N]); extern void permut...
C
#include<stdio.h> #include<stdlib.h> void main() { int *ptr,i; ptr=(int *)calloc(5,sizeof(int)); if(ptr==NULL) { printf("bellek yetersiz\n"); } for(i=0; i<5; i++) { printf("ptr[%d]=%d\n",i,ptr[i]); } printf("\n"); ptr=(int *)realloc(ptr,sizeof(int)*10); if(ptr==NULL) { prin...
C
#include <cmath> #include <vector> #include <math.h> #include<iostream> #include<fstream> #include "nr3.h" #include "ludcmp.h" #include "svd.h" #include "gaussj.h" using namespace std; void hw1(){ cout<< setprecision(8); //Problem 1 VecDoub x(2); x[0] = 1; x[1] = -1; std::cout<<x[0]<<std::...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> //#pragma warning(disable : 4996) typedef struct { char name[20]; int weight; int price; int star; } Product; int addProduct(Product* p); //product를 추가하는 함수 void readProduct(Product p); //각 한 개의 product를 출력하는 함수 void listProduct(Product* m[], int count);...
C
/* * ocs.c * * Created on: Oct 29, 2009 * Author: petergoodman * Version: $Id$ */ #include "successors.h" static player_t which_player; static int top = 0; static int bottom = BOARD_LENGTH - 1; static int right = BOARD_LENGTH - 1; static int left = 0; /** * Compare the importance ratings of two emp...
C
int solution(int A, int B, int K) { // write your code in C99 (gcc 6.2.0) int i; int divisible = 0; for(i=A; i<B+1; i++){ if(i%K == 0) divisible++; } return divisible; } // https://app.codility.com/demo/results/trainingFJYN4Y-RJN/ int solution(int A, int B, int K) { // wri...
C
#include <stdlib.h> #include <string.h> #include "out/liblokatt/filter-lexer.h" #include "filter.h" #include "lokatt.h" #include "stack.h" struct lokatt_filter { unsigned int event_bitmask; struct token *tokens; size_t token_count; struct token **rpn; size_t rpn_count; }; /* Replace any pair of chars '\x' wit...
C
/****************************************************************************** * This code is part of the NetDsn project by A. Frangioni, C. Gentile, * E. Grande and A. Pacifici * * This program produces a randomly-generated .par file to be fed to netgen. * * Claudio Gentile, May 28, 2009 * ***************...
C
#include <stdbool.h> #include <stdint.h> #include <stdlib.h> /* my god PNG is stupid. */ #define PNG_USER_MEM_SUPPORTED 1 #include <png.h> bool writepng(const char* filename, const uint16_t* buf, uint32_t width, uint32_t height) { png_structp png=NULL; png_infop info=NULL; FILE* fp = fopen(filena...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> strEnd (char *str, char *t) { char *p; p = str + strlen(str) - strlen(t); /* p aponta para o final da string str - tamanho de t */ while (*t){ if (*p != *t) return 0; p++; t++; } return 1; } int main(int argc, char** arg...
C
#include <stdio.h> #define num 100 int main() { int i; printf("Hello world!\n"); for (i = num; i > 0; i--) { printf("%i ", i); } printf("\n"); printf("START"); return 0; }
C
/* Copyright (c) 1986 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ /* This module is created for NLS on Sep.03.86 */ #ident "@(#)wschr.c 1.6 93/12/01...
C
#include "gba.h" #include "player.h" #include "sprites_id.h" #include <stdlib.h> #include <stdbool.h> #define MASK_NUM_MAX 20 #define MASK_PADDING 16 typedef struct { int id; int xPos; int yPos; bool collected; } Mask; typedef struct { Mask freeMasks[MASK_NUM_MAX]; int len...
C
#include <stdio.h> #include "ev/reduce.h" #include "measure/measure.h" #include "consts.h" #define BACKTRACKING_MAXIMUM (20) uint32_t backtrack_count = 0; bool reduce_eviction_set_rec(node *sentinel, uint32_t length, uintptr_t evictee); bool reduce_eviction_set(node *sentinel, uint32_t length, uintptr_t ev...
C
#define _XOPEN_SOURCE 700 // required for barriers to work #include <stdlib.h> #include <stdio.h> #include <pthread.h> #include <semaphore.h> int main(void) { pid_t childp; childp = fork(); int status; if (childp==0) { sleep(1); printf("Child process\n"); exit(0); } else { waitpid(childp, &status, 0); ...
C
#include<stdio.h> void del(char s[],int n) { int i; for(i=n;s[i+1]!='\0';i++) { s[i]=s[i+1]; } s[i]='\0'; } int main() { char a[200]; scanf("%s",a); int i,j; for(i=0;a[i]!='\0';i++) { for(j=i;a[j+1]!='\0';j++) { if(a[i]==a[j+1]) { del(a,j+1); j--; } } } p...
C
#include <string.h> #include <memory.h> #include <stdio.h> #include <stdlib.h> #include <stdio.h> #include <ctype.h> char str1[7] = "aabbcc"; int main (void) { char nig [] = "bullet to back" ; printf ("first %s\n", nig); memset (nig, '*', 6); printf ("second %s\n", nig); unsigned char src[7]= "123456"; ...
C
#include<stdio.h> int main() { int n,k,minimum,i; scanf("%d%d",&n,&k); int arr[n]; { for(i=0;i<n;i++) { scanf("%d",&arr[i]); } minimum=arr[0]; for(i=0;i<n;i++) { if(arr[i]<minimum) { minimum=arr[i]; } } printf("d",arr[k]); return 0; }
C
#ifndef buffer_h #define buffer_h #include <stdint.h> #include <stdbool.h> #include <string.h> #ifdef __cplusplus extern "C" { #endif typedef struct buffer_t buffer_t; //typedef buffer_t* buf_handle_t; // typedef uint8_t (*available)(buf_handle_t); /* Types */ //typedef unsigned int size_t; ...
C
/* ** my_is_prime.c for in /home/menich_a/rendu/Piscine-C-lib ** ** Made by menich_a ** Login <menich_a@epitech.net> ** ** Started on Tue Oct 8 13:46:55 2013 menich_a ** Last update Tue Oct 8 14:04:00 2013 menich_a */ int my_is_prime(int nb) { int i; i = 2; if (nb <= 0 || nb == 1) { return (0)...
C
/* phase5.c Students: Veronica Reeves Thai Pham University of Arizona Computer Science 452 Summary: implement a virtual memory (VM) system that supports demand paging. The USLOSS MMU is used to configure a region of virtual memory whose contents are process-specific. Using the USLOSS MMU to implement the virtual mem...
C
#define DISTANCE 3200 const int Dir_DS = 2; const int Dir_Sh = 3; const int Dir_St = 4; const int Dir_Rst = 5; const int Pul_DS = 6; const int Pul_Sh = 7; const int Pul_St = 8; const int Pul_Rst = 9; void setup() { //Direction Reg g pinMode(2, OUTPUT); pinMode(3, OUTPUT); ...
C
#include <stdio.h> int main (int argc, char* argv[]) { char char_h = 'H'; char char_k = 'K'; char char_0 = '0'; char char_4 = '4'; char char_5 = '\x5B'; char char_6 = '\x5D'; putchar(char_h); putchar(char_k); putchar(char_0); putchar(char_4); putchar(char_5); putchar(char_6); return 0; } ...
C
#include <p18f25k20.h> #include <timers.h> #include <delays.h> #include <stdlib.h> #include <adc.h> #include "RenLCD.h" #define OSCmask 0b10001111 #define Fosc 5 //4MHz char str[16]; int analog[2]; //***************************** // FUNCTION PROTOTYPES //***************************** void ini...
C
#include <stdio.h> int main() { int isListesi[100],x,n,i,j,toplam = 0,tmp; printf("Is listesinin uzunlugunu veriniz :"); scanf("%d",&n); for(i=0;i<n;i++) { printf("Is listesinin %d. elemani :",i+1); scanf("%d",&isListesi[i]); } printf("\n\n--Is listesi --\n"); for (i=0; ...
C
#include <stdio.h> #include <stdlib.h> #include "lista_ligada.h" p_no criar_lista() { return NULL; } void destruir_lista(p_no lista){ if (lista != NULL) { destruir_lista(lista->prox); free(lista); } } void destruir_listaI(p_no lista){ p_no atual, prox; for (atual = lista; atual !=...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_for_five.c :+: :+: :+: ...
C
/* ** EPITECH PROJECT, 2018 ** atof ** File description: ** . */ #include <stdbool.h> #include "n_for_stek.h" double my_atof(char *str) { double val = 0; int e = 0; int i = 0; while (*str != '\0' && is_number(*str) == true) val = val * 10 + (*str++ - '0'); if (str[i] == '.') while...
C
/* Quiz 2 題目敘述 寫一個程式計算給定日期為星期幾。輸入會先告訴程式某年的 1 月 1 號為星期幾,例如範例中 2012 年的 1 月 1 號為星期日。接著程式會收到一些日期,並要計算出給定日期為星期幾,例如範例中程式將會收到 11 月 13 號,並計算出該日期為星期二。 (閏年計算請參考wiki) 輸入格式 第一行包含一個西元年以及該年的一月一日為星期幾,如範例中 2012 0。注意,0 代表星期日,1 代表星期一,以此類推。第二行會告訴程式接下來將有 n 組日期需要計算。n 的範圍為 1 至 10。接下來的 n 行,每一行將會有一組需要計算...
C
#include <stdio.h> #include "../../../Helper/Array/Util/printArray.h" #include <malloc.h> void get2RepeatingItems(int *arr, int len, int *res1, int *res2) { int *count = (int *)calloc(len - 2, sizeof(int)); int i = 0, flag = 0; while (i < len) { count[arr[i] - 1]++; if (2 == count[arr[i] ...
C
#include <stdio.h> int main(){ unsigned char s; ch=32; while(s<=127){ printf("%c [%03d] ",s,s); s++; } printf("\n"); return 0; }
C
#include <zlib.h> #include <stdio.h> #include "kseq.h" KSEQ_INIT(gzFile, gzread) static int g_len = 35; int main(int argc, char *argv[]) { int l, i, j; kseq_t *seq; gzFile fp; if (argc == 1) { fprintf(stderr, "splitfa <in.fa> [len=%d]\n", g_len); return 1; } if (argc >= 3) g_len = atoi(argv[2]); fp = gzope...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <string.h> #include <ctype.h> #include <ncurses.h> #include "util.h" char username[9]={0}; int nrow = 15,ncol = 45; //char linharecebida[45]; //char useraeditarlinha[9]; //int posNL=-1; ...
C
#include <stdio.h> #include <math.h> int main(void) { double x1, x2, y1, y2; printf("ù° (x1, y1) : "); scanf("%lf %lf", &x1, &y1); printf("ι° (x2, y2) : "); scanf("%lf %lf", &x2, &y2); printf("Distance = %lf", sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)))); return 0; }
C
#include <pthread.h> #include <stdio.h> #include <stdlib.h> #define NUM_THREADS 3 int count = 0; pthread_mutex_t count_mutex; pthread_cond_t count_threshold_cv; int TCOUNT, COUNT_LIMIT; void *inc_count(void *t) { int j,i; double result=0.0; int my_id = (int)t; for (i=0; i < TCOUNT; i++) { pthread_mutex_lock(&cou...
C
#include<stdio.h> void main() { int n,m,k; printf("enter the values:"); scanf("%d %d",&n,&m); k=pow(n,m); printf("the answer is=%d",k); }
C
#include <stdio.h> #include <string.h> void main() { int c=0; char s[10]; char rev[10]; scanf("%s",s); int i=0; int j=0; while(s[i] != '\0') { c=c+1; i++; } for(i=c-1;i>=0;i--) { rev[i]=s[j]; j++; } rev[i]='\0'; printf("%s",rev); }
C
#include "commands.h" //---------------------------------------Functions only for reading Image File---------------------------------// void read_IMGFile(const char * imageFileName, TheImage * image) { FILE * imageFile; int readSize; imageFile = fopen(imageFileName, "rb"); if (!imageFile) { printf(...
C
#include <stdio.h> #include <ctype.h> int stack[1000]; #define SIZE_OF 1000 int i = 0; int evalute_prefix_boolean_expersion(char c[]); int stack_isnt_empty(); int is_op(char a); void push(char s); void make_boolean_expersion_to_prefix(char c[], char g[]); char pop(); int pop_int(); void push_int(); int main(...
C
#include <stdio.h> #include <string.h> #include "mpi.h" #include <time.h> int main(int argc , char * argv[]) { int my_rank; /* rank of process */ int p; /* number of process */ int source; /* rank of sender */ int dest; /* rank of reciever */ int tag = 0; /* tag for messages */ int message; /* storage for ...
C
/******************************************************************** * $ID: main.c Wed 2016-10-19 09:39:02 +0800 lz * * * * Description: * * ...
C
#include<stdio.h> #include<stdlib.h> #include<sys/socket.h> #include<netinet/in.h> #include<stdlib.h> #include<string.h> int main(int argc,char *argv[]) { FILE *fp; int sockfd,newsockfd,portno,r; char fname[100],fname1[100],text[100]; struct sockaddr_in serv_addr; portno = atoi(argv[2]); sockfd=socket(AF_INE...
C
#include <stdio.h> #include <stdlib.h> #include "binarieTree.h" #include "binarieTree.c" int main(){ bTree novaArv; Node *bsc; criaArv(&novaArv); inserirRaiz(&novaArv, 55); inserirValor(novaArv, 72); inserirValor(novaArv, 30); inserirValor(novaArv, 25); inserirV...
C
/**************getSource.c************/ #include <stdio.h> #include <string.h> #include "getSource.h" #define MAXLINE 120 /* 1行の最大文字数 */ #define MAXERROR 30 /* これ以上のエラーがあったら終り */ #define MAXNUM 14 /* 定数の最大桁数 */ #define TAB 5 /* タブのスペース */ static FILE *sourceFile; ...
C
#include "types.h" #include "stat.h" #include "user.h" #define NUM_OF_CHILDRENS 10 #define NUM_OF_CHILD_LOOPS 1000 int main(int argc, char *argv[]) { int i,j,index,wTime,rTime,ioTime = 0; int fork_id = 1; int c_array[NUM_OF_CHILDRENS][4]; for (i=0 ; i < NUM_OF_CHILDRENS ; i++) // init array for (j=0 ; j < 4 ; j...
C
/* *********************************************************************** File Name : p2p_sys_list.c Description : P2Pミドルウエア リスト構造操作関数定義 Remark : Copyright (c) 2004 by Matsushita Electric Industrial Co., Ltd 作成日: 2004/06/21 T.Inagaki 新規作成 修正日: 2011/06/30 Yoshino *******************************************...
C
/*************************************************************************** * MICA * File: RGB.h * Workspace: micaOs * Project Name: libMica * Version: v1.0 * Author: Craig Cheney * * Brief: * Header for controlling RGB LED * * Authors: * Craig Cheney * * Change Log: * 2018...
C
#include <stdio.h> #define N 30 int main(void) { char str[N]="abcdefghij"; char *ptr; ptr =str; while (*ptr != '\0') { printf("%c",*ptr); ptr++; } printf("\n"); return 0; }
C
// // 16bpp bitmap functionality // //! \file tonc_bmp16.c //! \author J Vijn //! \date 20060604 - 20070703 // /* === NOTES === * 20070704. Tested except for bmp16_line */ #include "tonc_memmap.h" #include "tonc_core.h" #include "tonc_video.h" // -------------------------------------------------------------------- ...
C
// exercise 1-15: rewrite the temperature conversion program of sectio 1.2 to use a function for conversion #include <stdio.h> // rewrite temp conversion program to use functions double celsiusToFahrenheit(double celsius) { return (9.0 / 5.0) * celsius + 32; } double fahrenheitToCelsius(double fahrenheit) { r...
C
#include <stdio.h> #include <stdlib.h> /* First Missing Positive */ #define DEBUG 1 void swap(int* i,int* j){ int t = *i; *i = *j; *j = t; } void dump(int* a, int N) { int i = 0; for(;i<N;i++) printf("%d ",a[i]); printf("\n"); } int firstMissingPositive(int* arr, int siz...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> static int do_cat(int fd); static void die(const char *s); int main(int argc, char *argv[]) { int i; if(argc < 2) { if (do_cat(STDIN_FILENO) < 0) { exit(1); } } else { for...
C
#include<stdio.h> #include<stdlib.h> #include<pthread.h> int x; void *increment() { int i; for(i=0;i<10000;i++) { x++; } } void *decrement() { int i; for(i=0;i<10000;i++) { x--; } } int main() { int pthread_equal(pthread_t tid1, pthread_t tid2); pthread_t tid1, tid2; pthread_create(&tid1, NULL, incre...
C
#include <stdio.h> #include <stdlib.h> #include "vehcule.c" #include "game.c" int main(int argc, char *argv[]) { int c; printf("choix de configuration: 1-configuration ,2-configuration\n"); scanf("%d",&c); char* file_name; switch (c) { case 1: file_name="config2.txt"...
C
#include <stdlib.h> #include <string.h> #include <stdio.h> #include "main.h" int main(int argc, char *argv[]) { //Compilador /* Função que recebe arquivo */ if(argc == 1) { //Execução sem enviar arquivo txt printf("[ERRO] Arquivo a ser lido não enviado\n"); return 0; } /* Função que...
C
#include <stdio.h> #include <GL/glut.h> #include "math.h" void init(void); void sinandcos(void); int main(int argc, char** argv) { glutInit(&argc, argv); // Initialize GLUT. glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); // Set display mode. glutInitWindowPosition(200, 100); // Set top-left di...
C
# include<stdio.h> # include<math.h> int main() { float x1,y1,x2,y2,x3,y3; scanf("%f %f",&x1,&y1); scanf("%f %f",&x2,&y2); scanf("%f %f",&x3,&y3); printf("\n"); float a = (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1); float b = (x3-x1)*(x3-x1)+(y3-y1)*(y3-y1); float c = (x3-x2)*(x3-x2)+(y3-y2)*(y3-y...
C
/*1652270 2 ˴*/ #include <stdio.h> #include <stdlib.h> //malloc/realloc #include <io.h> //exit /* P.10 Ԥ峣 */ #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 #define LOVERFLOW -2 typedef int Status; /* P.28 ʽ */ typedef int ElemType; //ɸҪ޸Ԫص typedef struct LNode { ElemType ...
C
/* * pseultra/tools/bootcsum/src/bootcsum.c * PIFrom ipl2 checksum function decomp * * (C) pseudophpt 2018 */ #include <stdint.h> #include <stdlib.h> #include <stdio.h> #define MAGIC 0x95DACFDC uint64_t calculate_checksum (uint32_t *bcode); static inline uint64_t checksum_helper (uint64_t op1, uint64_t op2, uin...
C
//perm_access.c - test access() #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <sys/stat.h> int main() { int fd; struct stat statbuf;; pid_t pid; uid_t ruid, euid; if (stat("test.txt", &statbuf) == -1) { perror("fail to stat"); exit(1); } ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_unsigned_itoa.c :+: :+: :+: ...
C
#include "userprog/syscall.h" #include <stdio.h> #include <syscall-nr.h> #include "threads/interrupt.h" #include "threads/thread.h" #include <devices/shutdown.h> #include <filesys/filesys.h> #include "userprog/process.h" #include "filesys/file.h" #include "devices/input.h" #include "threads/malloc.h" #include "vm/page...
C
//??? int fun(int n) { if (n % 400 == 0 || (n % 4 == 0 && n % 100 != 0)) return 1; else return 0; } int main() { int n = 0, i = 0; cin >> n; for (i = 1; i <= n; i++) { int year = 0, mon1 = 0, mon2 = 0, sum = 0, j = 0, temp = 0; cin >> year >> mon1 >> mon2; int mon[13] = {0, 31, 28 + fun(...
C
#include<stdio.h> #include<stdlib.h> /* Practica 4 Calculadora lunes 24 de febrero de 2020*/ float num1, num2, Resultado; int main() { char op; printf("Calculadora simple\n"); printf("Escribe el primer numero: \n"); scanf("%f", &num1); printf("Escribe la operacion a realizar: \n"); fflush(stdin); scanf...
C
/* ** EPITECH PROJECT, 2020 ** PSU_42sh_2019 ** File description: ** Returns the arguments of a command */ #include <stdlib.h> #include "my.h" char **parse_command(char const *command, char const sep) { char **args = NULL; args = my_str_to_word_array(command, sep); for (unsigned int i = 0 ; args[i] ; i++...
C
/* Escreva um programa em que o usurio insira um nmero qualquer. Se o nmero digitado for um da tabela abaixo, o programa deve retornar os caracteres indicados, seno, o programa deve retornar o caractere 0 (zero). Utilize o comando switch*/ #include <stdio.h> #include <stdlib.h> int main() { int numero; printf...
C
#include <stdio.h> #include <unistd.h> #include "../../Src/globals.h" int main(int argc){ if(argc >= 2){ return 1; } char *username = getlogin(); if(username == NULL){ puts(RED_TEXT"Error: Unable to Receive Username"RESET); }else{ printf("%s\n",username); } return 0; }
C
#include <stdio.h> #include "miniProject.h" #define PASS 1 #define FAIL 0 int test1(); // Test for meeting overlap int test2(); // Test for NULL int test3(); // Test for NULL int test4(); // Test for Loading from file int main() { //printf("Test 1 is %s\n", test1() ? "PASS" : "FAIL" ); //printf("Test 1 is %s\n", ...
C
#ifndef __oclga_simple_chromosome__ #define __oclga_simple_chromosome__ #include "ga_utils.c" typedef struct { int genes[SIMPLE_CHROMOSOME_GENE_SIZE]; } __SimpleChromosome; /* ============== populate functions ============== */ // functions for populate void simple_chromosome_do_populate(global __SimpleChromosome*...
C
#include "klist.h" #include "kset.h" #include "kmap.h" #include "klinkedlist.h" #include "kqueue.h" #include "kstack.h" #include "stdio.h" int equals(void *A , void *B){ // A , B are string ! if(strcmp(A,B) == 0){ return 1; }else{ return 0; } } int main() { int length,cursor; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* untangle_ways.c :+: :+: :+: ...
C
#include<stdlib.h> #include<string.h> #include<sys/types.h> #include<unistd.h> #include<stdio.h> char * getSelfLocation(){ char link[1024]; int n; char * exe; exe = ( char * ) malloc ( 1024 * sizeof(char)); if ( exe == NULL) { printf("Error allocating memory. Exiting \n"); exit(0); } snprintf(link,siz...
C
#include <stdio.h> int main (int argc, char* argv[]) {int numbers[4]= {0}; char name [4] = {'a'}; //first, print them out raw printf("numbers:%d %d %d\n", numbers[0], numbers[1], numbers [2],numbers [3]); printf("name each : %c %c %c %c\n", name[0],name[1], name [2],name [3]); printf("...
C
/*------------------------------------------------------------------------- * * soe_prf.c * High-level interface that abstracts the underlying PRFs used for * the generation of the ORAM pmap. * * identification * src/common/soe_prf.c * *------------------------------------------------------------------------...
C
/* * Description: * Provide the function prototypes for managing shared memory * * void* connect_shm(int key, int size) * - REQ_conn_1: This function has two arguments: * - The first argument serves as the key for the shared memory segment. * - The second argument contains the size (in bytes) of the shared mem...
C
#include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <sys/stat.h> #include <time.h> #include <string.h> #include "ux_fs.h" int main(int argc, char **argv) { struct ux_dirent dir; struct ux_superblock sb; struct ux_inode inode; time_t tm; off_t nsectors = UX_MAXBLOCKS; in...
C
#include <stdio.h> #include <stdlib.h> int jednaki(char *s1, char *s2) { int i = 0, b = 0; while(*(s1 + i) != '\0' && *(s2 + i) != '\0'){ if(*(s1 + i) != *(s2 + i)){ b = 1; break; } i++; } if(b == 0 && *(s1 + i) == '\0' && *(s2 + i) == '\0') ...
C
#include <stdio.h> #include <stdlib.h> /* * T = O(Nlog(N)) * * */ typedef int ElementType; void printArr(ElementType a[], int n){ int i; for(i = 0; i < n; i++){ printf(" <%d> ", a[i]); } printf("\n---------------------------\n"); } // 有序子列的归并,两个有序子列合并为一个有序子列 void Merge(ElementType A[], ElementType TempA[...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "person.h" /*_____________________*/ int main() { p1 = malloc(sizeof(struct Person)); strcpy(p1->name, "ȫ浿"); p1->age = 30; strcpy(p1->address, " 걸 ѳ"); printf("%s %d %s\n", p1->name, p1->age, p1->address); free(p1); r...
C
#include <stdio.h> #include <stdbool.h> char text[10000]; int main() { int i = 0; bool isFirstQuote = true; char ch; while((ch = getchar()) != EOF){ if(ch == 34 && isFirstQuote){ printf("``"); isFirstQuote = false; } else if(ch == 34 && !isFirstQuote){ ...
C
#include <stdio.h> #include <stdlib.h> void main(void) { printf("Hello world!\n"); const int length=10; const int width=5; int area; area=length*width; printf("area is equal %d",area); return 0; }
C
/* * Copyright (c) 1994,1996 by Sun Microsystems Inc. * All rights reserved. */ #ident "@(#)strcmp.c 1.1 96/09/20 SMI" #include <sys/salib.h> /* * Compare strings: s1>s2: >0 s1==s2: 0 s1<s2: <0 */ int strcmp(register char *s1, register char *s2) { while (*s1 == *s2++) if (*s1++ == '\0') return (0); re...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <errno.h> #include <sys/ioctl.h> #include <linux/spi/spidev.h> #define LENGTH 3 int main(int argc, char **argv) { int spi_fd = 0; int mode = SPI_MODE_0; int result; int value; struct spi_ioc_transfer spi;...
C
/* * Created on Sat Jul 11 2020 * * Created by: Glen Zachariah * For more: https://glenzac.wordpress.com * License: CC0 1.0 Universal * * For MSP430F5529LP * --------Hardware--------- * LED1 -> P1.0 (Red) * LED2 -> P4.7 (Green) * Button S1 -> P2.1 * Button S2 -> P1.1 * ------------------------- */ #inclu...
C
#include "stdlib.h" #include "math.h" #include "driver/i2c.h" #include "esp_log.h" #include "sensor.h" #define ERR_CHECK(f) \ err = f; \ if (err != ESP_OK) ...
C
/* pwm.c - analogWrite implementation for esp8266 Copyright (c) 2015 Hristo Gochkov. All rights reserved. This file is part of the esp8266 core for Arduino environment. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as publi...
C
/* * Funny Language - a free style programming language. * Copyright (C) 2015 by fanguangping (fanguangping@163.com) * math.c */ #include <stdlib.h> #include <math.h> #include <float.h> #include "operator.h" static Num g_zero = { .isFix = 1, {.longValue = 0L} }; static Num g_one = { .isFix = 1, {.longValue = 1L} ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* eval_expr.h :+: :+: :+: ...
C
/* * AUTHORS : <jonathanmarpaung88@gmail.com> * VERSION : 1.0.0 * TYPE : Header * LICENSE : MIT */ /* Make guard for this header */ #ifndef FGTL_HEADER_H #define FGTL_HEADER_H /* Include header event * for handle event */ #include "FGTL_Event.h" /* Include header system * for using system on terminal */...
C
#include <stdio.h> #include <string.h> #include "distance.h" #include "pythagoras.h" #include "nearLine.h" #define StrLen 256 /* * range: * * This function does the actual work of figuring out whether a city * is within the specified range of a set of fronts. The main() function * is just a driver and reporter....
C
Name:Change G.L Joshi Subject: engineering #include<stdio.h> #include<conio.h> int main(){ int a; printf("Enter the number or value\n "); scanf("%d",&a); if (a%5==0&&a%11==0) { printf("The value is divisible by 5 and 11 that is %d",a); } else {printf("the value is not divisible",a); } getch (); return 0...
C
#include <time.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <strings.h> #include <unistd.h> #include <netinet/in.h> #include <arpa/inet.h> #include <string.h> #define MAXLINE2 4096 //size of bytes for the buffer #define LISTENQ 1024 //size of the listening...
C
static inline void swap_uchar(unsigned char *b1, unsigned char *b2) { unsigned char t = *b1; *b1 = *b2; *b2 = t; } bool us_rc4_setup_s(us_rc4 o, unsigned char* key, size_t length) { bool res = 1; o->idx1 = 0; o->idx2 = 0; o->S = malloc(256); res = (o->S != NULL); if(res) { // first set all the S to the i...
C
#include "I2C.h" #include "io430.h" //Inicia I2C en USCI, falta pulir, ideal seria usar vectores de interrupción //Basado en ejemplo de TI void Init_I2C_USCI(unsigned char addr) { P1SEL |= BIT6 + BIT7; //Asigna la funcion de I2C a los pines SCL > P1.6, SDA > 1.7 Pag 49 msp430g2553 da...
C
#ifndef __RAYTRACER_H #define __RAYTRACER_H #include "vector.h" // color struct, RGB typedef struct color { float r; float g; float b; } COLOR; // define different shader model enums enum shader_model { LAMBERT_MODEL, PHONG_MODEL }; // define different geometry types enum geometry_type { SPHERE_GEO, PLAN...