language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include<stdlib.h> #include<unistd.h> #include<string.h> #include<stdio.h> int main(){ // create user buffer to store user string char user_buff[10]; printf("created buffer...\n"); // copy string into buffer memcpy( user_buff, "hello cody", strlen("hello cody")); printf("copied into buffer...\n"); // open...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* parse_arg_dlr.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> #include "employee.h" /* unsigned int employee_get_num (struct employee* list) { unsigned int i; for (i = 0; list[i].name[0]; i++); return i; } */ void employee_print (struct employee* e) { printf ("Name: %s\n", e->name); printf (" Age: %u\n", e->age); ...
C
#include<stdio.h> #define TRUE 1 #define FALSE 0 #define SIZE 4 int n = SIZE; int W[SIZE][SIZE] = { {0, 1, 0, 1}, {1, 0, 1, 0}, {0, 1, 0, 1}, {1, 0, 1, 0} }; int vindex[SIZE]; int promising(int i){ int j; int swt; if (i == n - 1 && !W[vindex[n - 1]][vindex[0]]){ // n-1 ΰ swt = FALSE; } else if (i > ...
C
extern int __VERIFIER_nondet_int(); /** Find a number greater than seed that is divisble by 3 */ int generateNumberDiv3(int seed){ int old; do{ old = seed; seed++; } while (old%3 != 0); return seed; } int main(){ // Generate a number that is divisible by 3 int seed = __VERIFIER_nondet_int(); int div3 = gen...
C
/* Feladat: Keresse meg a legnagyobb olyan 2003-nál kisebb egész számot, amely 123-mal osztható. */ // Horváth András József megoldása #include <stdio.h> int main() { for (int i = 2003; i >= 0; --i) { if (i % 123 == 0) { printf("%i\n", i); break; } } ...
C
#include "transaction_manager.h" #include "operations.h" #include "site_data.h" #include <ctype.h> #include <sys/select.h> #define SITE_FAILED_WAIT #define WRITE_PENDING 1 #define IS_WRITE_FINISHED 0 #define WRITE_FAILED -1 #define SLEEP_DURATION 200 void abortTrx(struct trx_opn *opn); void Sleep_ms(int time_ms); ...
C
#include <stdio.h> int contains(int x1, int y1, int x2, int y2, int x3, int y3) { double det, lambda1, lambda2, lambda3; det = 1.0 / ((y2 - y3) * (x1 - x3) + (x3 - x2) * (y1 - y3)); lambda1 = det * ((y2 - y3) * (-x3) + (x3 - x2) * (-y3)); if (lambda1 <= 0.0 || lambda1 >= 1.0) return 0; lamb...
C
// // Created by Ruochen Xie on 2019-07-25. // #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #define MaxVertexNum 100 #define INFINITY 65535 typedef int Vertex; typedef int WeightType; typedef struct GNode * PtrToGNode; struct GNode { int Nv; // 顶点 int Ne; // 边 WeightType G[MaxVertexNum][Ma...
C
/* ============================================================================ Name : secondProject.c Author : Arion Almond Version : Copyright : Open Source Description : This project dynamically allocates an array ============================================================================ ...
C
/****************************************************************************/ /* */ /* MAINLOOP */ /* Main Program Loop */ /* ...
C
#include<stdio.h> void main() { int i,j; printf("enter i & j : "); scanf("%d",&i); scanf("%d",&j); i=i+j-(i%j); printf("i =%d",i); }
C
#include <stdlib.h> #include <string.h> #include "locationList.h" #include "location.h" #include "../common/2d/2d.h" #include "../common/error/error.h" #include "../common/io/outputStream.h" #include "../common/io/printWriter.h" #include "../common/string/cenString.h" void initLocationList(LocationList* locationL...
C
/** *char *ecvt(double number, int ndigtis, int *decpt, int *sign); *ecvt()用来将参数number转换成ASCII码字符串。 *参数ndigits:表示显示的位数; *若转换成功,参数decpt指针所指向的变量会返回数值中小数点的地址(从左至右算起); *而参数sign指针所指的变量则代表数值的正负,若数值为正,返回0,否则返回1. * *返回值:返回一字符串指针,此字符串声明为static,若再次调用ecvt()或fcvt(), *此字符串的内容会被覆盖!!! * *注1:请尽量使用sprintf()做转换,而不是使用ecvt()。 *...
C
#include <stdio.h> #include <stdlib.h> typedef struct node { long long int d; long long int sum; } node; int main() { int t, n, i, num, j, N; scanf("%d", &t); while (t--) { scanf("%d", &n); node *arr, *out; arr = (node *)malloc(sizeof(node) * n); out = (node *)malloc(sizeof(node) * n); for (i = 0 ; i ...
C
#include<stdio.h> #include<stdlib.h> typedef struct ll { int data; struct ll *link; }link_l; link_l *head = NULL; int cnt =0; void insert(int n) { link_l *d =NULL; link_l *c = NULL; c = malloc(sizeof(link_l)); c->data = n; c->link = NULL; if(head == NULL) { head = c; } else { ...
C
/* * ===================================================================================== * * Filename: Hogwarts_Mod8_task2.c * Usage: ./Hogwarts_Mod8_task2.c * Description: Generate a random Array * * Version: 1.0 * Created: 03/21/2017 02:34:57 PM * Compiler: gcc -Wa...
C
#include <stdio.h> void dump(FILE *); // Cat prints each file in the argument list to the standard output. int main(int argc, char **argv) { FILE *f; if (argc == 1) { dump(stdin); return 0; } while (*++argv) { f = fopen(*argv, "r"); if (f == NULL) { fprintf(stderr, "cat: %s: No such file or directory...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> typedef struct BST_NODE { struct BST_NODE *l; struct BST_NODE *r; int pos; int v; }BST_NODE, *PBST_NODE; PBST_NODE BST_create(int v) { PBST_NODE n = (PBST_NODE) malloc (sizeof(BST_NODE)); if (n) n->v = v; return n; } void BST_insert (PBST_NO...
C
#include <stdio.h> #include <string.h> int get(unsigned short num, int n){ if((num & (1 << n)) != 0) return 1; else return 0; } unsigned short set(unsigned short num, unsigned short n, unsigned short bit){ if(bit == 0){ return num & (~(1 << n)); } el...
C
/*-------------------------------------- Herman Vanstapel ex02\ser.c Un serveur recevant une structure et lié à un client particulier ----------------------------------------*/ #include <stdio.h> #include <string.h> #include "../physlib/physlib.h" #include "structure.h" int main(int argc, char *argv[]) { int...
C
//Nick Sells, 2021 //level.c #include <stdlib.h> #include "level.h" //============================================================================= // GLOBALS //============================================================================= //NOTE: used to store rooms and hallways when generating a level. gets malloc...
C
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string.h> //int main() //{ // char arr[] = { 'b','i','t','\0' }; // printf("%d\n", strlen(arr)); // // return 0; //}; //void bubble_sort(int arr[10],int i,int sz) //{ // int n = 0; // int tmp = 0; // for (n = 0; n < sz - i; n++) // { // if (arr[n] > arr[n + 1]...
C
/* Name: Bryan Fernandez A C program that initializes clock speed at 4 MHz. &= Bitwise AND asignment operator. C &= 2 is same C = C & 2 ^= Bitwise exclusive OR operator C ^= 2 is same C = C ^ 2 |= Bitwise inclusive OR operator C |= 2 is same C = C | 2 & is AND 1 0001...
C
#include "gla.h" #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> gla_determinant * gla_determinant_alloc(const size_t n) { gla_determinant * d ; if(0 == n) PrintErr("Determinant dimension should be a positive integer" , GLA_EINVAL) ; d = (gla_determinant *) m...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> int print_matrix(int arr[3][3]) { int i,j; for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf("%d\t",arr[i][j]); } printf("\n\n"); } return 0; }
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* render_sprites.c :+: :+: ...
C
/********************************************************** * * scscan/src/c/scan.c * */ int beginScan(OPTIONS *options) { if (options->flags & SCAN_HRANGE) return _beginRangeScan(options); else return _beginListScan(options); } int _beginRangeScan(OPTIONS *opt...
C
#include "uart.h" void UsartInit(u32 baud){ u16 DIV_M = 0, DIV_F = 0; float DIV; // 串口、端口时钟使能 USARTx_CLK_EN = 1; IOPx_CLK_EN = 1; #if UART_5 // 配置TX复用推挽输出 TX_GPIOx->TX_CRx &= TX_RESET; TX_GPIOx->TX_CRx |= TXIO_Config; // 配置RX端浮空输入 RX_GPIOx->RX_CRx &= RX_RESET; RX_GPIOx->RX_CRx |= RXIO_Config; #el...
C
#include <stdio.h> #define PI 3.14 void main() { int rayon = 5, DiametreDuCercle = 0; double perimetre = 0, AireDuCercle = 0; DiametreDuCercle = rayon*2; perimetre = 2*PI*rayon; AireDuCercle = PI*rayon*rayon; printf("rayon : %d\n,Diametre du cercle : %d\n,Perimetre : %lf\n,Aire du cercle : %lf"...
C
/*AA*/ # include <stdio.h> void main() { int i,j; i=1; /*ѭʼǰIֵ1*/ do { /*ڲѭʼǰJֵ1*/ j=1; while(j<=10) { printf("A"); j++; /*ڲѭJֵ1*/ } printf("\n"); i++; /*ѭIֵ1*/ }while(i<=5); }
C
#include <sys/defs.h> #include <sys/memory/kmalloc.h> #include <sys/kprintf.h> #define INPUT_BUFFER_LENGTH 256 char* terminal_buffer; int terminal_buffer_end = 0; void init_terminal(){ terminal_buffer = sf_malloc(INPUT_BUFFER_LENGTH); } void terminal_input_ascii(char ascii){ if(terminal_buffer_end =...
C
#include "ft_dlist.h" t_dlist *ft_dlist_pop_back(t_dlist *lst, t_dlist_it **item) { (*item) = 0; if (lst->end) { if (lst->end->prev) lst->end->prev->next = 0; *item = lst->end; lst->end = lst->end->prev; if (!lst->end) lst->begin = lst->end; (*item)->prev = 0; --lst->size; } return (lst); }
C
// // Created by suitm on 2020/12/26. // #ifndef ISTIME_H #define ISTIME_H #include <inttypes.h> #include <time.h> #include <sys/time.h> #define ISTIME_VERSION_NO "21.08.1" char * istime_version(); /** 取当前时间的毫秒数 **/ uint64_t istime_us(); /** 根据time_us微秒信息,生成ISO8601的标准日期时间格式, 其实秒以下是舍弃的 **/ char * istime_iso8601(char...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* d12.c :+: :+: ...
C
# include<stdio.h> int main(){ int m,n; printf("Enter order of matrix : "); scanf("%d%d",&m,&n); int i,j; int a[m][n]; printf("Enter elements for array\n"); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { scanf("%d",&a[i][j]); } ...
C
#include "holberton.h" /** * _strcpy - Copy a string into other * @dest: String to copy. * @src: Buffer string * _putchar - Write characters * Return: 0 */ char *_strcpy(char *dest, char *src) { int i = 0, j = 0; while (src[i] != '\0') i++; for (; j <= i; j++) dest[j] = src[j]; return (dest); }
C
/* * Project: Drivers development tutorial * Target MCU: STM32F401XE * Author: Jakub Standarski * */ #include "nvic_irq.h" #include <stdint.h> /*****************************************************************************/ /* NVIC IRQ API DEFINITIONS */ /****************************************************...
C
#include "ft.h" #include "ft_test.h" int main(int argc, char **argv) { t_list **list; t_list *n1; t_list *n2; // t_list *n3; if (argc || argv) printf("./test_lstnew <n1> <n2> <n3>\n"); n1 = ft_lstnew((void *)argv[1]); list = &n1; n2 = ft_lstnew((void *)argv[2]); ft_lstadd_front(list, n2); while ((*list)-...
C
/* xmpl7.c * program to find prime numbers */ #include <stdio.h> #include <stdbool.h> int main(void) { /* Initialise our counter */ int i = 1; while (i <= 10000) { /* Initialise prime flag */ bool prime_flag = true; int j = 2; /* Test divisibility of i from [0, i/2] */ while (j <= i/2) { prin...
C
#include "model/service_list.h" #include <stdlib.h> int pat2services(pat_table_t *pat, service_table_t *srv) { puts("pat2services"); srv->cnt = 0; srv->items = malloc(sizeof(service_item_t)*pat->programs_cnt); program_desc_t *current = pat->programs; int i; for(i = 0; i < pat->programs_cnt; i++) { printf("i...
C
#include <stdio.h> #include <string.h> char converte(char c,int shift){ c=c-97; if(c>=0&&c<=26){ c=c+shift; c=c%26; if(c<0)c=26+c; } return c+97; } int main(){ char string[100]; int shift; fgets(string,100,stdin); scanf("%d",&shift ); for(int i=0;i<strlen...
C
/*Задача 2 Създайте нов потребителски тип към тип long long int. Използвайте го във функцията printf, отпечатайте размера. Задача 3. Дефинирайте потребителски тип към указател.Създайте променлива, насочете указателя към нея, използвайки новия потребителски тип.*/ #include <stdio.h> int main(){ typedef long long int...
C
/*Sean Kee*/ /*Dynamic Allocation Sorting System v1.0.1*/ #include <stdio.h> #include <stdlib.h> #include <time.h> void sortAsc(int *output, int size) { int i; /*Number of Passes*/ int j; int temp; int *ptr = output; for (i = 0; i < size - 1; i++) { for (j = 0; j < size - 1; j++) { if (ptr[j] > ptr[j + 1]) ...
C
/* -*- coding: iso-latin-1-unix; -*- */ /* DECLARO QUE SOU O UNICO AUTOR E RESPONSAVEL POR ESTE PROGRAMA. // TODAS AS PARTES DO PROGRAMA, EXCETO AS QUE FORAM FORNECIDAS // PELO PROFESSOR OU COPIADAS DO LIVRO OU DAS BIBLIOTECAS DE // SEDGEWICK OU ROBERTS, FORAM DESENVOLVIDAS POR MIM. DECLARO // TAMBEM QUE SOU RESPONSAV...
C
/* * initialize two global integer arrays x[10] and y[10] * when S2 us pushed an ISR will: * -calculate y[n] = 2*x[n] - x[n-1] */ #include <msp430.h> int x[10] = {5, 3, 7, 10, 4, 9, 2, 12, 7 ,8}; int y[10] = {0}; void main(void) { WDTCTL = WDTPW | WDTHOLD; P1OUT = 0x00; P1SEL = 0x00; P1DIR = 0xF7; P1REN =...
C
/* *************************************************************** * Filename: matrix.c * Description: Matrix Multiply code for Host. * Author: Unknown * ***************************************************************/ #include <accelerator.h> #include <matrix.h> #include <htconst.h> Hint poly_matrix_mul (void ...
C
// // main.c // 找数组中的最小值和次小值并输出 // // Created by mac on 15/12/3. // Copyright © 2015年 mac. All rights reserved. // #include <stdio.h> #include <time.h> #include <stdlib.h> int main(int argc, const char * argv[]) { int a[10],i; int s1,s2 = 0; s1=9; srand((unsigned)time(NULL)); for (i=0; i<10; i+...
C
/* tarea9.c Compilacin: gcc -o tarea9 tarea9.c Este programa ignora las interrupciones por teclado. */ #include <stdio.h> #include <signal.h> int main(){ struct sigaction sa; sa.sa_handler = SIG_IGN; // ignora la seal sigemptyset(&sa.sa_mask); // inicializa a vaco //Reiniciar las funciones que ...
C
#include <stdio.h> #include <string.h> #define max 20 int main() { char mes[max]; printf("Introduce el nombre de un mes: "); gets(mes); if (strcmp(mes,"febrero")==0){ printf("%s tiene 28/29 días\n",mes);} else if (strcmp(mes,"abril")==0||strcmp(mes,"junio")==0||strcmp(mes,"septiembre"...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_base64.c :+: :+: :+: ...
C
/*Values incorrects to big numbers like C(99,50), but for this problem is good enougth*/ #include<stdio.h> #define MAXN 100 #define MAXK 100 long int C[MAXN + 1][MAXK + 1]; void binCoeff(int, int); int min(int, int); int main(void) { int n, k; binCoeff(MAXN, MAXK); scanf("%d %d\n", &n, &k); while (n...
C
#include "binary_trees.h" /** * count - Count the nodes in a tree. * @tree: Pointer to the root node of the tree to traverse * Return: Number of nodes in a tree. */ int count(const binary_tree_t *tree) { if (!tree) return (0); if (tree->left || tree->right) return (count(tree->left) + count(tree->right) + 1)...
C
#include <stdio.h> #include <string.h> typedef struct{ int id; // 学生番号 int kokugo; // 国語の点数 int sansu; // 算数の点数 int rika; // 理科の点数 int shakai; // 社会の点数 int eigo; // 英語の点数 }student_data; void setData(student_data*,int,int,int,int,int,int); vo...
C
/* random.c - random generator Copyright (C) 2007 Uncle Mike 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 3 of the License, or (at your option) any later version. This program is d...
C
/* gcc -o aufgabe sched.c matrix.c -lpthread ./aufgabe 322 131 3 Initializing... Starting... Thread 0 beendet: 23 ms Thread 1 beendet: 29 ms Thread 2 beendet: 27 ms Langsamster Thread war 1: 29 ms Schnellster Thread war 0: 23 ms */ #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <limits.h> #inc...
C
#include <stdio.h> //void main() //{ // int n1, n2, i, gcd; // // printf("Կոָ"); // scanf("%d %d", &n1, &n2); // // for (i = 1; i <= n1 && i <= n2; i++) // { // if (n1 % i == 0 && n2 % i == 0) // { // gcd = i; // printf("Լ%d\n", i); // } // } // // printf("%d %d Լ %d", n1, n2, gcd); // // system("pause"); //}...
C
/* Program for reading/controlling CryoTel GT with AVC controller */ /* and putting said readings in to a mysql database. */ /* defined below. */ /* D.Norcini, UChicago, 2020*/ #include "SC_db_interface.h" #include "SC_aux_fns.h" #include "SC_sensor_interface.h" #include "ethernet.h" // This is the default instrumen...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #include <mbx.h> MBX_Handle MBX_create(int number) { MBX_Handle handle; handle = (MBX_Handle)malloc(sizeof(MBX_Obj)); pthread_mutex_init(&(handle->lock),NULL); pthread_cond_init(&(handle->cond),NULL); handle->b...
C
/* * 4_1_pwd.c * this is the file base on <understanding Unix/Linux Programing> P97 * based on the commander: pwd * useage: pwd * 2012-12-02 tusion@163.com */ #include<errno.h> // perror(); errno, #include<stdio.h> // printf(); #include<stdlib.h> // exit(); #include<string.h> // strcpy(); #include<dirent.h> // rea...
C
#include <stdio.h> #include <stdlib.h> static void dump_regs_and_stack() { int i; register int eax asm("eax"); register int ebx asm("ebx"); register int ecx asm("ecx"); register int edx asm("edx"); register int esp asm("esp"); register int ebp asm("ebp"); register int esi asm("esi"); register int edi asm("edi...
C
#include<stdio.h> #define Max_N 200001 int N; long int A[Max_N]; int M; long int B[Max_N]; long int Lvl[Max_N]; int L; long int Max, Min; void readCase() { int i; int j = 0; L = 0; int temp; Max = 0; Min = 1000000000; scanf("%d", &N); for (i = 0; i < N; i++) { scanf("%ld", &A[i]); if (A[i] > Max) { M...
C
#include<stdio.h> #include<conio.h> void main() { int n,f=0; clrscr(); scanf("%d",&n); while(n%2!=0) { if(n%2==0) { f=1; break; } } if(f==1) { printf("yes"); } else { printf("no"); } getch(); }
C
#include <stdio.h> #define PSQR(x) printf("The square of " #x " is %d.\n", ((x)*(x))) int main(void) { int y = 5; PSQR(y); //printf("The square of " "y" "is %d.\n", (y*y)); PSQR(2+4); //printf("The square of " "2 + 4" "is %d.\n",((2+4)*(2+4))); return 0; }
C
// shop.c inherit F_CLEAN_UP; #include <ansi.h> int help(object me); int main(object me, string arg) { string name, id; seteuid(getuid()); if (! arg) { SHOP_D->list_shop(me); return 1; } if (! wizardp(me)) return notify_fail("你...
C
/* ** EPITECH PROJECT, 2019 ** my_hunter ** File description: ** mathstick */ #include "../../include/my.h" void add_bn_at_end(char *str) { str[my_strlen(str)] = '\n'; str[my_strlen(str) + 1] = '\0'; } int exec_with_text(info_shell_t *sh, linked_list_t *list_env, char *text) { pid_t pid = fork(); int...
C
#include <unistd.h> #include <stdio.h> // unsigned char reverse_bits(unsigned char octet) // { // int i; // int r; // i = 0; // r = 0; // while (i < 8) // { // r |= (((octet >> i) & 1)) << (7 - i); // i++; // } // return (r); // } unsigned char reverse_bits(unsigned cha...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "reply.h" #include "channels.h" #include "structs.h" #include "functions.h" #include "handlers.h" #include "list.h" #include <unistd.h> #include <pthread.h> #include <time.h> /* The strategy for the I/O of handlers: take in message that is complet...
C
#include <stdio.h> #include <string.h> typedef struct alunos{ char nome[21]; int prob_res; } alunos; int main(){ int i, i1, aux, n; char aux_char[21]; scanf("%d", &n); alunos aluno[n]; for(i=0; i<n; i++){ scanf("%s %d", &aluno[i].nome, &aluno[i].prob_res); } //ordena o...
C
#include<stdio.h> /** *binary_to_uint - converst a binary number into an unsigned integer *@b:pointer to a string with 0 and 1 *Return:An unsigned integer */ unsigned int binary_to_uint(const char *b) { int i = 0; int j = 0; int m = 0; int k; unsigned int elem = 1; unsigned int ret = 0; if (b == NULL) ...
C
/* Date : 2017.08.04 * Author : NYB * Intro : 多线程,每个线程都调用函数A,函数A中访问全局变量,加锁访问。 * Result : global从0自增到MAX_COUNT */ #include <stdio.h> #include <pthread.h> #include <unistd.h> #include <stdlib.h> #define MAX_COUNT 5000000 #define SLEEP_TIME (1) void err_quit(const char *api); void thread_fun(void *arg...
C
#include <sys/socket.h> #include <unistd.h> #include <netinet/in.h> #include <stdlib.h> #include <errno.h> #ifndef BACKLOG #define BACKLOG 8 #endif #ifndef DUMB_RESPONSE // Show me some love, I could Rick Roll you! #define DUMB_RESPONSE "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\nHi there! I am a dumb web serv...
C
#include <stdio.h> void swap(int,int); void main() { int x=10,y=20; printf("(1)a=%d y=%d\n",x,y); swap(x,y); printf("(4)x=%d y=%d\n",x,y); } void swap (int a,int b) { int t; printf("(2)a=%d b=%d\n",a,b); t=a; a=b; b=t; printf("(3)a=%d b=%d\n",a,b); }
C
#include <stdio.h> #include <stdlib.h> typedef struct NODE { int value; struct NODE *next; } Node; int main(void) { Node *root = NULL; Node *tail; Node *node; int n; for(n = 1; n < 5; n++) { Node *node = malloc(sizeof(Node)); // If you not define Node *node here, then you have to define node = node->next at ...
C
#include<stdio.h> #include<stdlib.h> void main() { int n; system("clear"); printf("Enter any number:"); scanf("%d",&n); if(n<0) { n=(-1)*n; printf("Absolute value is %d",n); } }
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "VG/openvg.h" #include "VG/vgu.h" #include "./../src/fontinfo.h" #include "./../src/libshapes.h" int main() { const char msg[] = { 'H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', 0 }; int width, height; char s[3]; /* We ha...
C
/* <The C programming language> - 2nd Edition by K&R Exercise 1.13. Write a program to print a histogram of the lengths of words in its input. It is easy to draw the histogram with the bars horizontal; a vertical orientation is more challenging Compiler: MinGW.org GCC-8.2.0-3 by Gabe Gu 20...
C
int main() { int inta=0,i,a=0,b=0;//inta????????i????? cin>>inta; for(i=0;;i++) { if(inta%2==0) { a=inta/2; cout<<inta<<"/2="<<a<<endl; inta=a; } if(inta%2!=0&&inta!=1) { b=inta*3+1; cout<<inta<<"*3"<<"+1="<<b<<endl; inta=b;...
C
/* file: scoreboard.c student email(s): yhovich@uoguelph.ca, isinan@uoguelph.ca, amontagu@uoguelph.ca, ssial@uoguelph.ca, ramsayl@uoguelph.ca, mabdulba@uoguelph.ca, group #: Group 3 (Section 2) date: November 3, 2017 description: File containing the source code for accessor and mutator functions for User...
C
#include <stdio.h> #include <stdlib.h> #define ARRAY_SIZE 10 int main() { int *array = calloc(sizeof(int), ARRAY_SIZE); for(int i = 0; i < ARRAY_SIZE; i++) { //array[i] = i; *(array + i) = i; } for(int i = 0; i < ARRAY_SIZE; i++) { printf("%d\n", arra...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <ctype.h> int compareFiles(int fd1, int fd2){ // 대소문자, 공백 허용 char ch1, ch2; int isSame = 0, res1, res2; // ch1 : ANS, ch2 : STD while(1){ printf("isSame1 = %d\n",isSame); ...
C
/** * @file stack.c * @author Gonzalo Arcas & Ciro Alonso * @date 14 March 2020 * @brief ADT Stack * * @details definicion de las funciones stack.h * * @see */ #include "stack.h" #include <errno.h> extern int errno; #define MAXSTACK 1024 struct _Stack{ int top; Element *item[MAXSTACK]; }; Stack * stack_ini...
C
/* Name: Sunil giri Subject: Programming fundamentals. Program:to print pascals triangle. Roll no.: Bcs Sem:1st Date:jan 12 2017 */ #include<stdio.h> int factorial(int a); int main() { int z,n,i,fact,j; printf("Enter number of terms to print pascal triangle:"); scanf("%d",&n); for(i...
C
// // Created by adrian on 09.09.2019. // /* Good morning! Here's your coding interview problem for today. This problem was asked by Facebook. Given a 32-bit integer, return the number with its bits reversed. For example, given the binary number 1111 0000 1111 0000 1111 0000 1111 0000, return 00...
C
#include<stdio.h> #include<conio.h> int main(void){ int a,b,c; float real=0,imag=0; int disc; printf("Enter the coefficients\n"); scanf("%d %d %d",&a,&b,&c); disc = b*b - (4*a*c); if(disc>0){ real = (-b + sqrt(disc))/(2*a); imag = (-b - sqrt(disc))/(2*a); } if(disc==0...
C
#include <stdlib.h> #include <signal.h> #include <stdio.h> int main(){ sigset_t blk_set; sigemptyset(&blk_set); sigaddset(&blk_set, SIGINT); sigaddset(&blk_set, SIGTSTP); sigprocmask(SIG_BLOCK, &blk_set,NULL); //Obtener variable del entorno char *sleep_secs = getenv("SLEEP_SECS"); int secs = atoi(sleep_s...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include <unistd.h> #include <stdarg.h> #include <fcntl.h> #include <sys/mman.h> #include <sys/stat.h> int main(int argc, char *argv[]) { if (argc <= 1) { printf("Something is wrong with the arguments"); ex...
C
// clearerr_ex.c : clearerr() example // ------------------------------------------------------------- #include <stdio.h> // void clearerr(FILE *fp); #include <stdlib.h> int main() { FILE *fp; int c; if ((fp = fopen("infile.dat", "r")) == NULL) fprintf(stderr, "Couldn't open input f...
C
#include <stdlib.h> #include <unistd.h> #include <string.h> #include "libc/brk.h" void *realloc(void *old, size_t size) { void *top; void *now = __cur_brk; size = ((size + 15) / 16) * 16; top = sbrk(size); if (top == (void *)-1) return NULL; if (old) memmove(now, old, size); return now; }
C
//---------------------------rail way reservation project by using c programming language-------------------------- //---------------------------------------header file start----------------------------------------- #include<stdio.h> #include<windows.h> #include<stdlib.h> #include<conio.h> #include<time.h> #include<str...
C
#include <stdio.h> #include <stdlib.h> #include "random_cache.h" // // A simple data store with cache // #define DATA_SIZE 1000 #define CACHE_SIZE 10 // // Data is stored in array data[] // float data[DATA_SIZE]; int nhits = 0; int nmisses = 0; CACHE *cache; // initialize the data array void init() { int i; ...
C
#include <stdio.h> #include <string.h> #define to_str(XX) (#XX) void perform (const char buf[80]) { const int size = strnlen (buf, 80); for (int i = 0; i < size; i++) printf ("%c", buf[i]); printf ("\nrest:\n"); for (int i = size; i < 80; i++) printf ("%i", buf[i]); } int main (void) { const int blackVal = 10;...
C
// // BMMeasurementBuffer.c // AudioFiltersXcodeProject // // Created by Hans on 11/3/20. // This file is public domain. No restrictions. // #include "BMMeasurementBuffer.h" #include "Constants.h" #include <stdlib.h> #include <Accelerate/Accelerate.h> void BMMeasurementBuffer_init(BMMeasurementBuffer *This, size...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> int MaxOfSum(int *arr, int sz, int *idx_min, int *idx_max) { int *dp = (int *)malloc(sz * sizeof(int)); memset(dp, 0, sz * sizeof(int)); for(int i = 0; i < sz; i++) { if(i == 0) { dp[i] = arr[i];...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_makestr.c :+: :+: :+: ...
C
// // stickman.c // Fighting Game // // Created by Daniel Keller on 9/1/16. // Copyright © 2016 Daniel Keller. All rights reserved. // #include "character_internal.h" #include "objects/stickman.h" #include "engine.h" #include <math.h> #include <assert.h> enum stickman_states { top, bottom, overhead, forward, ...
C
/* ** EPITECH PROJECT, 2019 ** eval_expr_test_2.c ** File description: ** Will test the return of several expression */ #include <criterion/criterion.h> #include <stdlib.h> #include "my.h" Test(eval_expr, simple_addition) { char const *base = "0123456789"; char const *ops ="()+-*/%"; char const str[] = {"...
C
/* Copyright (c) 2010, Jeremy Cole <jeremy@jcole.us> 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. T...
C
#include<stdio.h> #include<conio.h> float gastos[12]; int x; main() { for(x=1;x<13;x++) { printf("Dame los gastos del mes [%d]: ",x); scanf("%f",&gastos[x]); } for(x=1;x<13;x++) { printf("Los gastos almacenados en el mes [%d] son: %.2f\n",x,gastos[x]); } getch(); }