language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <errno.h> #include <signal.h>//This header file contains definitions of a number of function and datatypes used in signals #include <sys/types.h>//This header file contains definitions of a number of data types used in system calls #include <sys/socket...
C
#include<stdio.h> void main() { printf("\nHello world!\nThis is my First Git Commit.\n"); printf("First change."); }
C
#include <unistd.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include "ftp_client.h" int main() { ftp_init(); struct ftp_connect client; memcpy(client.hostname, "192.168.0.107", sizeof(client.hostname)); client.control_port = 21; memcpy(client.username, "odin...
C
#include <stdlib.h> #include <stdio.h> #include "bst.h" #define ADD_RED printf("\033[1;31m") #define END_RED printf("\033[0m") static void CreateTest(); static void InsertTest(); static void IterTest(bst_t *tree); int IsBefore(void *data1, void *data2, void *param); int main() { /*CreateTest();*/ InsertTes...
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { int altura,idade,cont; scanf("%d %d",&altura,&idade); if(altura>=140 && idade>=14) { cont++; } if(altura>=150 && idade>=12) { cont++; } if(altura>=170 || idade...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> #include<assert.h> #include<stdbool.h> #include<limits.h> #define clr(arr)do{ memset(arr, 0, sizeof(arr)); }while(0) #define swap(a,b) do{ typeof(a) tp; tp = a; a = b; b = tp; }while(0) typedef long long ll; const ll mod = 1000000007ll; int main(...
C
// ļҪڹڶάIJ #ifndef __MAT_ #define __MAT_ #include <stdlib.h> #include <string.h> #include <stdio.h> #include <math.h> //#include <random> #include <time.h> #define full 0 #define same 1 #define valid 2 typedef struct Mat2DSize{ int c; // У int r; // Уߣ }nSize; float** rotate180(float** mat, nSize matSize);// ת180 ...
C
#include "asprintfx.h" #include <stdlib.h> #include <stdarg.h> #include <stdio.h> #include <assert.h> char *asprintfx(const char *fmt, ...) { char *dest; va_list ap; int len; assert(fmt != NULL); dest = NULL; va_start(ap, fmt); len = vsnprintf(dest, 0, fmt, ap); dest = (char*)malloc(len + 1); vsprintf(d...
C
/*#include<stdio.h> int calculation(int fac_number){ if(fac_number==0 || fac_number==1){ return 1; } else{ return fac_number*calculation(fac_number-1); } } void main(){ int number,factorial; printf("enter a number for factorial:"); scanf("%d",&number); factorial=calculation(number);...
C
#include <stdio.h> int main (){ long int n_segundos; printf("Insira o numero em segundos: "); scanf("%ld", &n_segundos); printf("Horas \t: %d\n",(int) n_segundos/3600); printf("Minutos \t: %d\n",(int) (n_segundos%3600/60)); printf("Segundos \t: %d\n",(int) n_segundos%60); }
C
// // Created by Jedrzej on 03.07.2018. // #import <stdio.h> void cwiczenie19(void) { int c; int space_counter = 0; while ((c = getchar()) != EOF) { if (' ' == c) { space_counter++; if(space_counter < 2) { printf("%c", c); } continu...
C
#include<stdio.h> #include<stdlib.h> #defineCOMPARE(x,y)((x==y)?0:(x>y)?1:-1) structnode { floatcoeff; intexp; structnode*link; }; typedefstructnode*polypointer; voidattach(floatcoefficient,intexponent,polypointer*ptr) { polypointertemp; temp=(polypointer)malloc(sizeof(structnode)); temp->coeff=coefficien...
C
/* * @file taskpool_policies_wrapper.c * * Created on: Mar 30, 2015 * Author: yulongb */ #include "lift_task_queue.h" #include <malloc.h> #include <stdlib.h> #include <pthread.h> static unsigned int N_LENGTH_OF_TASK_POOL = 4; static request_type_t *task_pool_secret = (void *)0; static pthread_mutex_t task_p...
C
#include <avr/io.h> #include "UART.h" int main( void ) { char cad[20]; uint16_t num; UART0_init(1); while(1) { UART0_getchar(); UART0_puts("\n\rIntroduce un nmero:\n\r"); UART0_gets(cad); num = atoi(cad); itoa(cad,num,16); UART0_puts("\n\rHex:"); UA...
C
#ifndef ALUMNO_H_INCLUDED #define ALUMNO_H_INCLUDED #include <stdio.h> #include <stdlib.h> typedef struct { int d; int m; int a; }t_fecha_ing; typedef struct { int dni; char nya[40]; char sexo; float prom; int notas[10]; t_fecha_ing fecha; char estado; }t_alumno; int cargarA...
C
/* Programming Exercise 12-4.c */ // Write and test in a loop a function that returns the number of times it has been called. #include <stdio.h> int function(); int main(void) { int times; scanf("%d", &times); for (int i = 0; i < times; i++) { printf("The function has been called for %d ti...
C
/*+-------------------------------------------------------------------+ | <DOC> | | <NAME> obj_cmod(), obj_change_mode() | | <AUTHOR> John L. Foster | | <DATE> March 7, 1989 ...
C
/* * Copyright (c) 2009 Sven Bachmann (dev@mcbachmann.de) * * 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
//AITKEN.C //Aitken #include <math.h> #include <stdio.h> double aitken(x, eps, f) double x, eps, (*f)(double); { int flag = 0, k = 0; double u, v; while ((flag == 0) && (k <= 100)) { k = k + 1; u = (*f)(x); v = (*f)(u); if (fabs(u-v)<eps) { x = v; flag ...
C
#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int sumTwo(int a, int b) { return (a+b); } int square(int n) { result(n*n); } int get_max(int x, int y) { if(x > y) return(x); else return(y); } int main(int argc, c...
C
#include "lista_sentinela.h" int main() { TipoElemento aux; char string[256] = {}; // lista_criar ============================================================ Lista* l = lista_criar(); printf("Lista: %p ", l); printf("Sentinela: %p\n\n", l->sentinela); // printf("Ant: %p | Prox: %p\n", l-...
C
#include <stdio.h> #include <io_utils.h> #include <errno.h> #include <string.h> #define COPY_SUCCESS 0 #define COPY_ILLEGAL_ARGUMENTS -1 #define COPY_SRC_OPEN_ERROR -2 #define COPY_SRC_READ_ERROR -3 #define COPY_DEST_OPEN_ERROR -4 #define COPY_DEST_WRITE_ERROR -5 #define COPY_UNKNOWN_ERROR -100 int CopyFile(char cons...
C
#include <stdio.h> #include <sys/time.h> #include <time.h> #include "misc.h" #define MAX_ITEM_NAME_LEN 100 void fillDate(Date *d) { struct timeval tv; struct tm *now; gettimeofday(&tv, NULL); now = gmtime(&tv.tv_sec); d->month = now->tm_mon + 1; d->year = now->tm_year + 1900; d->day = now->...
C
/* 2014-Apr-03: Why??? Just use doubles... */ static inline double tv_to_double(struct timeval *tv) { return (tv->tv_sec + tv->tv_usec/1000000.0); } static inline int tv_lt_diff(struct timeval *tv1, struct timeval *tv2, struct timespec *diff) { if (tv1->tv_sec > tv2->tv_sec || (tv1->tv_sec == tv2->tv_sec &...
C
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* * See COPYRIGHT in top-level directory. */ #include <stdio.h> #include <pthread.h> #include "abt.h" #include "abttest.h" void task_hello(void *arg) { ABT_xstream xstream; ABT_thread thread; ABT_task task; ABT_unit_type type; ABT...
C
#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #define BUFFER_SIZE 4096 struct time { size_t hours; size_t minutes; size_t seconds; size_t milliseconds; }; void die(const char *msg); void process_time(struct time *t, char *token, size_t offset); int main() { size_t...
C
#include "param.h" #include "types.h" #include "stat.h" #include "user.h" #include "syscall.h" #include "traps.h" #define TEST_NAME "crowd_outofthreads" #include "318_test-tapish.h" #define LOTS NTHR-3 #define SLEEP_EVERY 4 #define STKSIZE 1024 #define STRINGIFY(x) # x #define XTRINGIFY(x) STRINGIFY(x) #define BAIL...
C
#include <stdio.h> #define isopen(p) ((p)->flag & (_READ | _WRITE)) int fseek(FILE *fp, long offset, int origin) { if (fp == NULL || !isopen(fp)) return EOF; if (fp->flag & _WRITE) { if (fflush(fp)) return EOF; } else { offset -= (origin == SEEK_CUR) ? fp->cnt : 0L; fp->cnt = 0; } if (lse...
C
#include "util.h" typedef int bool; #define true 1 #define false 0 #define SYS_READ 3 #define SYS_WRITE 4 #define SYS_OPEN 5 #define SYS_CLOSE 6 #define SYS_LSEEK 19 #define SYS_EXIT 1 #define STDIN 0 #define STDOUT 1 #define STDERR 2 #define SEEK_CUR 1 #define SEEK_END 2 #define O_RDONLY 0 #define O_WRONLY 1 #def...
C
/* * @Author: your name * @Date: 2020-01-04 11:11:55 * @LastEditTime : 2020-01-09 15:56:53 * @LastEditors : Please set LastEditors * @Description: 假定数据域的四个变量存的数据是唯一的 注意字符串的比较,必须用函数strcmp() * @FilePath: \myshare\manager_system_v3\show.c */ #include "show.h" //头文件 int show(stPeople *h...
C
#include <stdio.h> #include <stdlib.h> void pr1(int *a){ *a = 10123; } void pr2(int** a){ *a = (int*) malloc(sizeof(int) * 10); **a = 1; } int main(){ int c[] = {5,3,2,10}; int *a = c; printf("%d\n", a[0]); pr1(a); printf("%d\n", a[0]); pr2(&a);//direccion de la direccion, apuntador a un apuntador...
C
#define solution isJasons #include <stdio.h> int n, m, t1, t2, a[100000], b[100000], c[100000]; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); b[i] = c[i] = 0; } scanf("%d", &m); while (m--) { scanf("%d%d", &t1, &t2); b[t1] = -t2; } b[0] = a...
C
#include <sys/types.h> #include <err.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char **argv) { int fd; off_t from, till; size_t sz; char *endptr, *buf; if ((fd = open(argv[1], O_RDONLY)) == -1) err(1, "open: %s", argv[1]); from = strtoull(argv[2], &endptr, 10);...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> int main() { int a, b, c, m, n; scanf("%d%d", &a, &b); if (a < b) { c = b; b = a; a = c; } m = a * b; n = a % b; while (n != 0) { a = b; b = n; n = a % b; } printf("%d %d", b, m / b); return 0; }
C
#include <stdio.h> #define MAX_DEER_COUNT 200 int get_rudolph_number(int barn[]); int array_value_count(int , int array[]); int main() { int barn[MAX_DEER_COUNT]={0}; int deer_count; int counter = 0; int rudolph_index; scanf("%d",&deer_count); if(deer_count > 200) { printf("deer count can't be more than 20...
C
#ifndef INT_UTILS_H #define INT_UTILS_H #include <stdio.h> #include <stdlib.h> #include <gmp.h> //#define MAX(x, y) (((x) > (y)) ? (x) : (y)) //#define MIN(x, y) (((x) < (y)) ? (x) : (y)) void max_z(); void min_z(); void gcd_z(); void lcm_z(); void pow_z(); void max_z(mpz_t max, mpz_t a, mpz_t b) { if(mpz_cmp(a...
C
// importe de input e output #include <stdio.h> #include "teste.h" // *p // p = ponteiro // &p = endereço de p na memoria // *p = conteudo do endereço de memoria int main () { int a,b, *c, g; // =========== Ponteiro ========== // se *c então o valor é atribuido no endereço, caso c entao o valor se torna o ende...
C
#include <stdio.h> #include <pthread.h> #include "programs.h" #include <semaphore.h> //office acts as the buffer to queue students to talk to the professor int office[officeSize]; int officeSize; int officeCounter; //students are semaphores void Student(int id) { int i; int length = (id % 4) + 1; sem_t stude...
C
#include<stdio.h> int main(){ int number; printf("Enter a number : \n"); scanf("%d",&number); if(number>=0){ printf("This is a Positive number"); }else { printf("This is a Negative number"); } return 0; }
C
#include "Utils.h" void __listR(Tree_t *bst, Tree_t **arr, int *count) { if (!bst) return; __listR(bst->left, arr, count); arr[(*count)++] = bst; __listR(bst->right, arr, count); } Tree_t *__pushR(Tree_t *bst, void *key, void *value, size_t ks, int *hchange) { if (!bst) //node folha { *hchange ...
C
#include<stdio.h> int fact(int n) { if(n==0) return 1; else return n*fact(n-1); } int ncr(int n,int r) { int num,den; num=fact(n); den=fact(r)*fact(n-r); return num/den; } int main() { int n,r; scanf("%d%d",&n,&r); printf("%d",ncr(n,r)); return 0; }
C
#include <stdio.h> #include <assert.h> #include "linkedList.h" /* Double Link Struture */ struct DLink { TYPE value;/* value of the link */ struct DLink * next;/* pointer to the next link */ struct DLink * prev;/* pointer to the previous link */ }; /* Double Linked List with Head and Tail Sentinels */ st...
C
/* ** EPITECH PROJECT, 2019 ** pushswap ** File description: ** my_put.c */ #include "pushswap.h" void my_put_array(int len, int *arr) { int i = 0; for (i = 0; i < len; i++) { my_put_nbr(arr[i]); my_put_char(' '); } my_put_char('\n'); }
C
#include<stdio.h> int chkprop(int n){ int i, num_of_factors=0; int factors[n]; for(i=1; i<n; i++){ if(n%i==0){ factors[num_of_factors]=i; num_of_factors++; } } int j,k,l, prod, max=0; for(i=0; i<num_of_factors; i++){ for(j=0; j<num_of_factors; j++){ for(k=0; k<num_of_factors; k++){ ...
C
/*Program to use for loop */ #include<stdio.h> void main() { int x,y; for(x=1,y=100;x<=100,y>=1;x++,y--) printf(" %d \t %d \n",x,y); }
C
#include <stdio.h> int main() { int a, b, c; scanf("%d", &a); b = (a - 1) / 2; c = b; for (int i = 1; i <= (a - 1) / 2; i++) { for (int j = 1; j <= b; j++) { printf(" "); } b--; for (int j = 1; j <= 2 * i - 1; j++) { printf("*"); } printf("\n"); } b++; for (int i = 1; i <= a; i++) { printf("...
C
//============================================================================== // Message Class Library // // (C) Copyright IBM Corp. 1997, 2005 All Rights Reserved //============================================================================== //--------------------------------------------------------------------...
C
#include<stdio.h> int main() { int n,year; printf("enter the months"); scanf("%d",&n); printf("enter the year"); scanf("%d",&year); switch(n) {case 1: case 3: case 5: case 7: case 8: case 10: case 12:printf("no.of days is 31"); break; case 2:if(year%400==0) { printf("display 2...
C
/** Triggers the options for the different game states. * This option also invokes the get up behavior after a fall, as this is needed in most game states. */ option(HandleGameState) { /** As game state changes are discrete external events and all states are independent of each other, a common transition can...
C
#include "config.h" #define MSG_BUFFER_SIZE (50) char *msg = (char *)malloc(MSG_BUFFER_SIZE); enum Status { ON, OFF, UNKNOWN }; Status stat = OFF; unsigned long lastMsg = 0; unsigned long lastReading = 0; unsigned long started = 0; unsigned long duration = 0; void setupOutputs() { pinMode(digitalOutputPin1...
C
#include "varray.h" #include <ctype.h> void varray_init(varray * v, unsigned int minsize) { if ( minsize < 8 ) minsize = 8; v->capacity = minsize; v->array = (int*) malloc(sizeof(int) * v->capacity); v->size = 0; } void varray_free(varray * v) { free(v->array); v->capacity = 0; v->size = 0; } int varray_capac...
C
void printPatients(int client_connection_fd){ PatientList* current = head; while(current != NULL) { write(client_connection_fd, &(current->patient), sizeof(Patient)); current = current->next; } char endString[10]; strcpy(endString, "end"); write(client_connection_fd, &endString, sizeof(endString)); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* cursoractions.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> #include <ctype.h> #include "dictionary.h" void print_list(VNode *head){ VNode *cur = head; while(cur){ printf("%s ", cur->value); cur = cur->next; } printf("\n"); } int compare(const void *l1, const void *l2) { return *(char*)l1 - *(char*)l2; } int main (int argc, cha...
C
#include "../../../inc/mh_collection.h" typedef struct mh_array { mh_collection_t collection; mh_ref_t ptr; size_t size; size_t element_size; mh_context_t *context; } mh_array_t; typedef struct mh_array_iterator { mh_iterator_t iterator; size_t position; mh_array_t *array; } mh_array_...
C
//how to insert all element of array into another array #include<stdio.h> void main() { int i,m,n,loc; printf("Enter size of array a: "); scanf("%d",&m); int a[m]; for(i=0;i<m;i++) { printf("Enter a[%d]: ",i); scanf("%d",&a[i]); } printf("Enter size of arr...
C
#define _XOPEN_SOURCE 600 #ifndef _UT_COMMON_H_ #define _UT_COMMON_H_ /** * ut Private API */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/time.h> #include <ucontext.h> #include "list.h" #define MAX_TIME_SEC 99999 #define MAX_TIME_USEC 99999 #define UT_TCB_NAMELEN 100 #define STKSIZE (6...
C
#include <stdio.h> float o_to_c(int o); int main(void){ int o; float c; printf("IX͂ĂF"); scanf("%d", &o); c = o_to_c(o); printf("%d IX%f Jbvł",o,c); return 0; } float o_to_c(int o){ return o / 8.0; }
C
#include<stdio.h> #include<conio.h> main() { int a[2][2],i,j; clrscr(); printf("enter elements into array:\n"); for(i=0;i<2;i++) { for(j=0;j<2;j++) { scanf("%d",&a[i][j]); } } printf("the elements in the array are:\n"); for(i=0;i<2;i++) { for(j=0;j<2;j++) { printf("%d\t",a[i][j]); } printf("\n"); ...
C
struct neuron { vector<double> weights; double activation=1; neuron() {} neuron(int n) //n = number of dendrites { weights.resize(n); assign_random_wts(); } void create(int n) { weights.resize(n); assign_random_wts(); } void assign_random_w...
C
#include<stdio.h> #include<stdlib.h> #define SIZE 5 int main() { int i; int A[SIZE]; int *ptr; ptr=(int *)malloc(SIZE*sizeof(int)); printf("Enter %d elements:\n",SIZE); for(i=0;i<SIZE;i++) { scanf("%d",(ptr+i)); } printf("Elements Are:\n"); for(i=0;i<SIZE;i++) { printf("%d\t",*(ptr+i)); } free(ptr)...
C
给定一个文档 (Unix-style) 的完全路径,请进行路径简化。 例如, path = "/home/", => "/home" path = "/a/./b/../../c/", => "/c" 边界情况: 你是否考虑了 路径 = "/../" 的情况? 在这种情况下,你需返回 "/" 。 此外,路径中也可能包含多个斜杠 '/' ,如 "/home//foo/" 。 在这种情况下,你可忽略多余的斜杠,返回 "/home/foo" 。 //2018-12-27 //2018-12-28 "/EQnvK///U/./../LQnJc/./rI/Ckzz/lmO/./" //2018-12-29 "...
C
#include<stdio.h> #include<stdlib.h> struct Node{ int data; struct Node* left; struct Node* right; };struct Node* root=NULL; struct stacknode{ struct Node* t; struct stacknode* link; };struct stacknode* top=NULL; struct Node* create(int element){ struct Node* newnode=(struct Node*)malloc(sizeof(struct Nod...
C
#include <leetcode.h> bool canPlaceFlowers(int* flowerbed, int flowerbedSize, int n) { int i, j; if (!n) return true; i = 0; if (!flowerbed[i]) { i++; if (i < flowerbedSize) { if (!flowerbed[i]) n--; } else { n--; } } for (j = 0; i < flowerbedSize && n; i++) { if (flowerbed[i]) { i...
C
//α׷ 7. ϴ Լ #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int print_leapYear(int year) { if (year % 4 == 0) return year; } int main() { int year, count=0; for (year = 2000; year < 2100; year += 4) { printf("%d ", print_leapYear(year)); count++; if (count % 10 == 0) printf("\n"); } }
C
#include "main.h" #include "menu.h" #include "storage.h" void testMenu() { consoleSelect(&topScreen); consoleClear(); iprintf("Storage Check Test\n\n"); consoleSelect(&bottomScreen); consoleClear(); int free = -1; int size = -1; //Home menu slots { iprintf("Free Home Menu Slots:\n"); ...
C
#pragma once #include "Math/Math.h" #include "Math/Vec.h" #include "Math/Mat.h" struct Quaternion { union { struct { union { struct { float x; float y; float z; }; Vec3f v; }; float w; }; float data[4]; }; Quaternion() : x(0), y(0), z(0), w(1) {}; Quaternion(float x, ...
C
#include <stdlib.h> #include <string.h> #include <stdarg.h> #include <assert.h> #include <unistd.h> #include <sys/sysinfo.h> #include <pthread.h> #include "list.h" #include "times.h" #include "sched_timer.h" #include "logger.h" #define TIMER_MAX_ARG 8 struct timer { struct list_head list; long long deadline;...
C
/* Exercizer for gaussian integration package. /**/ #include <math.h> #include <stdio.h> #include "Laguerre.h" #include "Jacobi.h" #include "Hermite.h" #define N 8 #define k 5 #define FLOATk 5.0 #define ZERO 0.0 #define SqrtPI 1.77245385090551603 main() { short m; double abscis[N]; double wt[N]; do...
C
#include<stdio.h> #include<stdlib.h> #include<assert.h> typedef int SLDataType; struct ListNode { int val; struct ListNode* next; }; void SListInit(struct ListNode** pplist); void SListDestroy(struct ListNode** pplist); int SListSize(struct ListNode* plist); struct ListNode* SListFind(struct ListNode* plist, SLDa...
C
#include <stdio.h> #include <stdlib.h> void clrscr() { // for (size_t i = 0; i < n; i++) // { // printf("\n"); // } system("@cls||clear"); // this shit uses the system commands } int main() { double n1; double n2; char op; printf("Enter a number: "); scanf("%lf", &n1)...
C
/*--------------------------------------------------------------------------- | | Framework 2 - Associations | | So events can trigger multiple actions. | |--------------------------------------------------------------------------*/ #ifndef LINKS_H #define LINKS_H #include "sysobj.h" // An assoc...
C
#include "stdio.h" int max(int x, int y, int z) { if(x<y) { if(z<y) return y; else return z; } else { if(z<x) return x; else return z; } } int main() { int t,i,j,k,cal,r,c,x,y,swp; scanf("%d",&t); for(i=0;i<t;i++) { scanf("%d %d",&r,&c); int arr[r][c],rra[2][c]; for(j=0;j<r;j++...
C
#include "chardev.h" /* Globals localized to file (by use of static */ static int Major; /* assigned to device driver */ static char msg[BUF_LEN]; /* a stored message */ static struct request *task_queue = NULL; //head of linked_list for mode 5 & 6 //struct used to send requests to threads static struct request { ...
C
/* * File: server_functions.c * Authors: DanMat27 * AMP */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <time.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include "../includes/server.h" #include "../includes/server_functions.h" #include "../inc...
C
/* * Copyright 2017 kapejod, all rights reserved. * * Scanner for RTP NAT stealing vulnerability, for research / educational purposes only! * Works only on big endian machines and ipv4 targets. */ #include <string.h> #include <sys/socket.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <fcn...
C
// Creates a child process and registers a signal handler to get exit status of child process // asynchronously #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <time.h> #define true (1) #define false (0) void signalHandler(int); in...
C
#include <stdio.h> #define SIZE 50 long int A[SIZE]; long int dpfib(int n); int main() { int i; A[0] = 0, A[1] = 1; for(i = 2; i < SIZE; i++) A[i] = -1; int n = 40; printf("%d fib no %ld\n", n, dpfib(n)); return 0; } long int dpfib(int n) { if(A[n - 1] == -1) A[n - 1] = dpfib(n - 1); if(A[n - 2] == -1) ...
C
#include <stdio.h> #include <stdlib.h> typedef struct stu { int num; char name[30]; float grade[3]; float avevage; struct stu *next; }STU; int main(){ STU *head = NULL; STU *p = NULL; STU stu_med; FILE *fp; int i = 0; fp = fopen("stud_dat","r"); if (fp) { printf("file opened\n"); } else { printf("...
C
#include <libopencm3/cm3/common.h> #include <libopencm3/stm32/rcc.h> #include <libopencm3/stm32/gpio.h> #include <libopencm3/stm32/f4/spi.h> #include "lcd.h" static void delay(int i) { int j,k=0; while(k++ < i) for (j = 0; j <= 300; j++) { __asm__("nop"); } } void transfer_command(int data1)...
C
#include <video.h> #include <salir.h> #include <matar.h> #include <video.h> #include <sodero/syscalls.h> /** * Ejecutable encargado de interrumpir la ejecucion de un proceso que se * encuentra corriendo. */ int main (int argc, char* argv[]) { int pid; int rta; if ( argc != 2 ) { imprimir_cadena ( "E...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> #include <sys/ipc.h> #include <sys/shm.h> #include <wait.h> int pid; int pipe1[2]; int pipe2[2]; int main(){ // create pipe1 if (pipe(pipe1) == -1) { perror("bad pipe1"); exit(1); } // fork (ps aux) if ((pid = fork...
C
#include <stdio.h> #include "tree.h" #include <stdlib.h> #include "pessoa.h" Tnode *ABPRemoveUmFilho(Tnode *root, void *key, int(*cmp)(void*, void*)); int CheckBin(Tnode *t); int CheckSearchTree(Tnode *t, int(*cmp)(void*, void*)); void visit(void *data){ int *aux; if (data != NULL){ aux = (int*)data; prin...
C
#ifndef GAMEUTILS_H #define GAMEUTILS_H #include "types.h" /*! * \file GameUtils.h * \brief A set of functions to deal with game mechanics * \author BOULAY Mathias * \version 1.0 * \date 15 janvier 2021 */ /** * @brief Tells if someone won. * @param[in] Map The GameMap to Check on * @fn bool HasSomeoneWon...
C
#include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <unistd.h> #include <signal.h> #define ALARM_TIME 15 void miFuncion(int); void miAlarma(int); void seCorto(int); int condicion = 1; int cant = 0; int main(void) { signal(SIGUSR1, miFuncion); signal(SIGINT, seCorto); // ctrl+C signal(...
C
#include <stdio.h> #include <string.h> void subs(char firstStr[], char secondStr[], int start, int end){ // i'll make this a function for substringing. int i=0; while ((i) < end) { // while the length exists, i want to add the the value of firstStr (start+i) into secondStr. s...
C
#include <stdio.h> /** * main - entry into the function * Description: prints all possible combinations * of 2 digit numbers * Return: Always 0 (successful) */ int main(void) { int first; int second; for (second = 0; second <= 9; second++) { for (first = second + 1; first <= 9; first++) { putchar(second + '0');...
C
#include<stdio.h> #include<string.h> int main() { char str[100],str1[50]={"HELLO"},str2[50]={"HOLA"},str3[50]={"HALLO"},str4[50]={"BONJOUR"},str5[50]={"CIAO"},str6[50]={"ZDRAVSTVUJTE"}; char str7[10]={"#"}; long long i=0; while(1) { i++; scanf("%s",str); if(strcmp(str,str7)==0) return 0; else if(strcmp...
C
#include <stdio.h> int main(void) { int a, b, c, maxx; printf("a="); scanf("%d", &a); printf("b="); scanf("%d", &b); printf("c="); scanf("%d", &c); if(a>=b && a>=c) { maxx = a; } else if(b>=a && b>=c) { maxx = b; } else { maxx = c; } printf("Maximul este %d\n", maxx); return 0; }
C
#include<stdio.h> void main() { int num,temp,sum=0,rem; printf("\n Enter the number"); scanf("%d",&num); temp=num; while(temp!=0) { rem=temp%10; sum=sum+rem; temp=temp/10; } printf("\n%d",sum); }
C
#include <stdio.h> #include <string.h> int main(){ int hash[256] = {0}; int n, k, i; scanf("%d\n", &k); char s[100]; scanf("%[^\t\n]s",s); n = strlen(s); for(i=0; i<n; i++) hash[(int)s[i]]++; int a=0; for(i=0; i<256; i++) if(hash[i]==k) a++; printf("%d\n", a); return 0; }
C
#include <stdlib.h> #include <mysql.h> #include "DbConnection.h" #include "LibRoo.h" int dbSet = 0; DbConnectionSettings _dbConnection; // Implementation of DbConnection.h DbConnectionSettings* GetDbConnectionSettings () { return &_dbConnection; } #define DBCLEANSE(dbattr) tryfree (settings->dbattr); void Cleanse...
C
/* * (C) Copyright 2010 * Texas Instruments, <www.ti.com> * Aneesh V <aneesh@ti.com> * * See file CREDITS for list of people who contributed to this * project. * * 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 ...
C
#include<stdio.h> void main() { int n,r,q; printf("enter the number"); scanf("%d",&n); if(n<27) { printf("%c",64+n); } else if(n>=27) { q=n/26; r=n%26; printf("%c%c",64+q,64+r); } }
C
#include <stdio.h> int _naive_set( double *in_data, int in_time, double *out_data) { if(in_time==0) //Used on the first forecast { *out_data = in_data[0]; return 0; } else if(in_time==1) //Used on the second forecast { *out_data = in_data[1]; return 0; } else if(in_time<0) ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* des_convertors.c :+: :+: :+: ...
C
#include "holberton.h" /** * add - a function that adds two numbers. * @m: int * @n: int * Return: an int **/ int add(int m, int n) { int result; result = m + n; return (result); }
C
//Determinar si los delimitadores en una expresion aritmetica estan balanceados //Delimitadores (),[],{}. //Por ejemplo: (x + 4), (x + 3 * [2 + 4]) #include <stdio.h> #include "Pila.h" int main(){ PILA mipila; char expresion[100],i; int band = 0; init(&mipila); printf("Exp...
C
int abs_diff(int x,int y) { int res = 0; if(x>=y){ res = x-y; } else{ res = y-x; } return res; }
C
//#include <stdio.h> // //void main() { // /* // * նѭ5ɼ浽double飬 // */ // //ͳʼķʽ // int arr2[3] = {10, 20, 80}; // //ڶʱֱӾֵָʡС // int arr3[] = {10, 20, 80}; // //һ // double arr[5]; // int arrLen = sizeof(arr) / sizeof(double); // int i; // for (i = 0; i < arrLen; i++) { // pr...