language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/*******************************************************************************\ | gavrInterrupt.c | Author: Todd Sukolsky | Initial Build: 4/16/2013 | Last Revised: 4/16/2013 |================================================================================ | Description: This module is a spin-off of commandCenter.c. ...
C
/* * Simple microseconds delay routine, utilizingARM's DWT * (Data Watchpoint and Trace Unit) and HAL library. * Intended to use with gcc compiler, but can be easily edited * for any other C compiler. * Max K * * * This file is part of DWT_Delay package. * DWT_Delay is free software: you can redistrib...
C
#include <stdio.h> int main() { int arr1[100], arr2[100], mergeArray[100*2]; int size1, size2, mergeSize; int index1, index2, mergeIndex; int i,j,temp; printf("Enter the size of first array : "); scanf("%d", &size1); printf("Enter elements in first array : \n"); for(i=0; i<size1; i++...
C
// // lab2.c // lab2 // // Created by yuejing zhu on 2017/9/6. // Copyright © 2017年 Xianng. All rights reserved. // #include <stdio.h> int main(int argc, const char * argv[]) { int f0 = 0, f1 = 1; int loop_number = 20; int number = 0; printf("First 20 Fibonacci numbers are:\n"); for ...
C
#define BYTE unsigned char #define WORD unsigned short #define DWORD unsigned int #define QWORD unsigned long long void blank2zero(QWORD* name) { int i; QWORD temp; for(i=0;i<8;i++) { temp = ( (*name)>>(i*8) )&0xff; if(temp == 0x20) { ...
C
#include <linux/init.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/seq_file.h> #include <linux/proc_fs.h> #include <linux/jiffies.h> #include <linux/sort.h> int cmp(const int *a, const int *b) { if (*a > *b) return 1; if (*a < *b) return -1; return 0; } #define PROC_NAME "sort" ...
C
/*WAP to multiply a 3*3 matrix.*/ #include<stdio.h> int main() { int a[3][3],b[3][3],c[3][3]; int i,j; printf("\nenter element of first matrix"); for(i=0;i<3;i++) for(j=0;j<3;j++) scanf("%d",&a[i][j]); printf("\nenter element of second matrix"); for(i=0;i<3;i++) for(j=0;j<3;j++) scanf("%d",&b[i][j]); ...
C
#include<stdio.h> #include<unistd.h> #include<errno.h> #include<fcntl.h> #include<string.h> #include<sys/types.h> #include<sys/stat.h> #include<stdlib.h> #define BUFFER_SIZE 1024 int main(int argc, char *argv[]){ int fd; char buffer[BUFFER_SIZE]; if(argc != 2){ fprintf(stderr, "...
C
/* A library for binary decision diagrams. * * Many operations are given with worst-case complexity measures, * based on the number of nodes in the BDD arguments. We write '|f|' * to denote the number of nodes in BDD f. */ #ifndef BDDLIB_INCLUDED #define BDDLIB_INCLUDED #include <stdio.h> #include "boolean.h" ...
C
#include "lua.h" #include "lstate.h" #include "llex.h" #include "lparser.h" #include "blocks.h" #include <string.h> #include <sys/time.h> #if LUA_USE_BLOCK_CONTEXT static char *parseErrMsg(const char *error_msg, int *err) { const char *whereEnd = NULL; const char *lineEnd = NULL; const char *messageStar...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> //1st code //ص㡪򻯴룬븴 //int Add(int x, int y) //{ // int z = x+y; // return z; //} // //int main() //{ // int a = 10; // int b = 20; // int c = Add(a, b); // // printf("%d\n", c); // return 0; //} //2nd code 飺һͬԪصļ // //ķʣͨ± //int main() //{ ...
C
#include <GLFW/glfw3.h> #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <termios.h> #include <string.h> #include <sys/ioctl.h> /* * The serialport_init function is taken from the 'arduino-serial' library * located at https://github.com/todbot/arduino-serial.git * Courtesy of ...
C
#include <stdio.h> #include <unistd.h> #define cls printf("\033[H\033[2J") int main() { int i, iMax; i = 0; iMax = 10; while(i <= iMax) { printf("Sto contando...%d\n" , i); i++; sleep(1); cls; } printf("Ho contato fino a %d" , iMax); ...
C
//Getopt() manejo de opciones -algo #include <stdio.h> #include <unistd.h> #define ARGUMENTOS "i:oh" int main (int argc, char *argv[]) { int opcion = 0; char *opcion1Valores = NULL; while ( (opcion = getopt(argc, argv, ARGUMENTOS)) != -1) { switch( opcion ) { case 'i': /* optarg tiene los valores des...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_process_char.c :+: :+: :+: ...
C
#include "s32k144_lpuart.h" #include "device_registers.h" #include "clock_manager.h" /*! * @brief Sends the LPUART 8-bit character. * * This functions sends an 8-bit character. * * * @param base LPUART Instance * @param data data to send (8-bit) */ void lpuart_Putchar(LPUART_Type * base, uint8_t data)...
C
/** @file DS18B20 sensor API main code #include "DS18B20_API.h" /*********************************//** *DS18 sensor init fucntion. Initializes the basics for the usage of the sensor. *************************************/ void DS18_Init(void){ DS18_GPIOInit(); DS18_TIMInit(); } /*********************************...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int main(void){ srand ((int) time (NULL)); //declare variables int input = 0; int divisor; int dividend; int quotient; int count = 0; //loop for 10 times for(int i=0; i<10; i++){ //setting random values divisor = rand () % 12+1; quo...
C
#ifndef MATH_FUNCTIONS_H #define MATH_FUNCTIONS_H const double MASTER_MOE; const double PI; // returns the absolute value of the input. Input can be any integer or double but it returns the value as a double. double shoesMath_abs(double input); // returns the remainder of dividing the input by the divisor. I...
C
/* ############################################################### ## ## C Tree Builder ## ## File: tree.c ## ## Revision 0.0.0.2 1996/04/03 10:26:06 kurt ## Added line,column to some printouts; ## addresses of nodes printed out, too. ## -- Kurt C...
C
/******************************************** Name: Isaias Delgado, Alex Hollis Course: CSCE 3110.002 Assignment: Program 6, Dijkstra's Algorithm Due Date: May 01, 2015 at 11:55PM ********************************************/ #include <stdio.h> #include <time.h> #define infinity 998 #define M...
C
#include <drivers/screen.h> #include <kernel/memory.h> #include <libs/stdio.h> #include <libs/string.h> #include <stdarg.h> void printf(const char *fmt, ...) { va_list arg; va_start(arg, fmt); int i = 0; int state = 0; int fmt_length = 0; char ch; char c; int num; unsi...
C
#pragma once typedef unsigned long long ulong; enum operation_type // { summ, prod, diff, none }; typedef struct value_t // , { enum operation_type operation; float result; }value_t; typedef struct tnode // { int key; void *data; struct tnode *left; struct tn...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include "define.h" //read temporal maps and spatial maps by referring to "spatial_pairlist.txt" and "temporal_pairlist.txt". int ReadST(char *s_listname, char *t_listname, short **t_input, short **s_input){ FILE *fp0,*fp1,*fp2; ...
C
// ============================================================================= // <core/platform/os.h> // // Compile-time operating system detection. // // Copyright Kristian Garnét. // ----------------------------------------------------------------------------- #ifndef H_E933C36BFDD54DB8A5B047C37F93C0A0 #define H_...
C
#include <conio.h> /* kbhit, getch */ #include "binary.h" #include "screen.h" #include "cpu.h" #include "opcodes.h" int Accumulator; int next_instruction(int counter) { /* the next instruction to execute */ if (counter < 255) { return counter+1; } /* else, loop back around to z...
C
#include <stdio.h> #include <string.h> int main() { char string[100]; int R, TOTALWORDS; TOTALWORDS = 1; printf("\n PLEASE ENTER A STRING: "); gets(string); for (R = 0; string[R] != '\0'; R++) { if (string[R] == ' ' || string[R] == '\n' || string[R] == '\t') ...
C
#include "holberton.h" #include <stdio.h> /** * *string_toupper-Entry point * @s: is a variable pointer * @ * @ * Return: Always 0. */ char *string_toupper(char *s) { int a; for (a = 0; s[a] != '\0'; a++) { if (s[a] >= 'a' && s[a] <= 'z') { s[a] = s[a] - 32; } } return (s); }
C
// // main.c // Assign1A // // Created by Greyson Wright on 1/30/18. // Copyright © 2018 Greyson Wright. All rights reserved. // #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <string.h> int main(int argc, const char * argv[]) { int n = atoi(argv[...
C
#include <stdint.h> #include <stdlib.h> #include <assert.h> #include <stdio.h> #include "gamma.h" #include <stdbool.h> #include <string.h> int main() { /* scenario: test_random_actions uuid: 192061291 */ /* random actions, total chaos */ gamma_t* board = gamma_new(5, 8, 6, 10); assert( board != NULL ); assert( gam...
C
#include <stdio.h> #include <string.h> #include <sys/time.h> #include <time.h> #include "induction.h" #include "timeutil.h" int i_time_check_past (struct timeval *now, struct timeval *control) /* Is now past then... if so, then a 1 is returned */ { if (now->tv_sec > control->tv_sec) return 1; /* Control time...
C
#include "csapp.h" #include <sys/ipc.h> #include <sys/shm.h> #define ARRAY_SIZE 40000 #define MALLOC_SIZE 100000 #define SHM_SIZE 100000 #define SHM_MODE (SHM_R |SHM_W) /*user read/ write*/ char array[ARRAY_SIZE]; /*uninitialized data = bss*/ static int a[10] = {0}; int main(int argc, char *argv[]) { int shmid; c...
C
// Program to print the greatest common divisor using Euclid's algorithm #include<stdio.h> int gcd(int, int); int main() { int j, k; printf("Enter two no.s : "); scanf("%d%d",&j,&k); printf("Greatest common divisor is: %d",gcd(j,k)); return 0; } int gcd(int a, int b) { int r, res; while(...
C
#include <stdio.h> #include <stdlib.h> long long expo(int x, int n) { if(n==0) { return 1; } return x*expo(x,n-1); } long long expo2(int x , int n) { if(n==0) return 1; else if(n%2 == 0) { long long y = expo2(x,n/2); return y*y; ...
C
#include <stdio.h> #include <math.h> int main() { double a,b,c,d,e,f,r1,r2,rr,ir; printf("enter the cofficient of the equation \n"); scanf("%lf%lf%lf", &a,&b,&c); d=b*b-4*a*c ; if(d == 0) { r1=r2= -b/2*a; printf("roots are equal r1=r2 %lf\n", r1); } else if(d>0) { ...
C
#include<stdio.h> #include<string.h> main() { char str[10],str2[10]; int i; printf("enter some string"); scanf("%s",str); for(i=0;str[i]!='\0';i++) { str2[i]=str[i]; } str2[i]='\0'; strrev(str); if(strcmp(str,str2)==0) printf("string is palindrome"); }
C
#include <stdio.h> char busca_binaria(int* vetor, int key, int size){ int inicio = 0; int fim = size - 1; int meio = 0; while (inicio <= fim){ meio = (fim - inicio) / 2 + inicio; if (vetor[meio] == key) break; else if (vetor[meio] < key) inicio = ++meio; else fim = --meio; meio++; } return me...
C
// this is a small independent file (not part of the libccc test suite) #include <libccc_string.h> #include <libccc_list.h> #include <libccc_io.h> #include <stdio.h> #define COUNT 8 int main() { static char* lines[COUNT] = { "Yo my boi", "What's up dog", "Not much, you ?", "...", "Yo spit it out", "...
C
#include <stdlib.h> #include <stdio.h> int Answer; int partition( int a[], int l, int r) { int pivot, i, j, t; pivot = a[l]; i = l; j = r+1; while( 1) { do ++i; while( a[i] <= pivot && i <= r ); do --j; while( a[j] > pivot ); if( i >= j ) break; t = a[i]; a[i] = a[j]; a[j] = t; } ...
C
// The skill room of the adventurer's guild. // // DarkeLIB 0.1 // -Diewarzau 5/7/96 #include <std.h> #define DEFAULT_SCREEN_SIZE 75 #define EXCLUDE ({ "control_change.c", "long_term.c", "skill.c", "lore_skill.c" }) inherit ROOM; int calc_skill_inc(object who, string skill); int dev_cost(object who, string ...
C
#include <stdio.h> int main() { int max,m,n; printf("Please input m and n:"); scanf("%d,%d",&m, &n); if (0 >= m || 0 >= n) { max = 0; } max = m % n; while (max > 0) { m = n; n = max; max = m % n; } printf("%d\r\n", n); }
C
//Hanna Rakhsha //CS 4328 - Xiao Chen //Due Date: 09/19/2019 //This program creates a child TO parent pipeline. The child executes ./pre //and the parent executes ./sort. #include <unistd.h> #include <stdio.h> #include <sys/types.h> int main(int argc, const char * argv[]){ int p[2]; int pid; if (pipe(p) ...
C
#include<pthread.h> #include<stdio.h> #include<unistd.h> #include<stdlib.h> pthread_mutex_t *mtx1,*mtx2; void *thread_fn1(void *arg) { printf("\n locking mutex1\n",__func__); pthread_mutex_lock(mtx1); printf("\n mutex1 is locked\n",__func__); sleep(2); pthread_yield(); printf("\n locking mutex2\n",__func__); pthread_m...
C
/* Enter your solutions in this file */ #include <stdio.h> #include <math.h> int max(int [], int); int min(int [], int); float average(int [], int); int mode(int [], int); int factors(int, int []); int max(int a[],int x) { int maxi=a[0]; for(int i=0;i<x;i++) { if(a[i]>maxi) maxi=a[i]; } return maxi...
C
#ifndef _UTIL_MEM_CACHE_H_ #define _UTIL_MEM_CACHE_H_ #define MD5_LEN 16 #include <stdlib.h> typedef void(*fn_free_cache)(const void*); enum cache_stat { EN_STAT_NORMAL, EN_STAT_TRANSF, }; typedef struct block_t { unsigned char md5[MD5_LEN]; size_t key_len; const void* value; fn_free_cache free_fn; block_t* ...
C
#include<stdio.h> int main() { char n, m; printf("Enter a letter: \n"); scanf("%c",&n); m = 'z' -(n - 'a'); printf("\n%c \n", m); }
C
#include "raylib.h" int partition(int *arr, int start, int end, int *states){ for(int i = start; i < end; i++){ states[i] = 0; } int newStart = start; int pivot = arr[end]; states[start] = 0; for (int i = start; i < end; i++){ if (pivot > arr[i]){ in...
C
/*Iterative method for Binary searching an sorted array*/ #include <stdio.h> int search(int A[],int b,int n){ int mid; int high=n-1,low=0; int result=-1; while(low<=high){ mid=(low+high)/2; if(low>high){ return -1; } else if(b==A[mid]){ return mid...
C
/* [Title] Subrectangle Queries [Level] Medium [Acceptance] 90.3% [DATE] June. 22. 2020 [TIME] 4:00PM ~ 5:00PM (1h) [Reference Site] LeetCode.com [Questions] Implement the class SubrectangleQueries which receives a rows x cols rectangle as a matrix of integers in the constructor and supports two methods: 1. updateSu...
C
/*******************************************************************/ /* CT30A3370 Käyttöjärjestelmät ja systeemiohjelmointi * my-grep.c * Aino Liukkonen * 21.4.2021 */ /*******************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> /* Read user-spe...
C
/* Autor: Jos Molina Date: 21/02/2019 */ #include "dht11_h.h" #include <stdint.h> #define _XTAL_FREQ 8000000 void dht11_begin(void) { DATA_DIR = 0; // Data pin as output DATA = 0; __delay_ms(18); DATA = 1; __delay_us(20); DATA_DIR = 1; //Data pin as input } void dht11_check(voi...
C
/* ** EPITECH PROJECT, 2020 ** MY PARAMS TO LIST ** File description: ** Put parameters into a chained list */ #include <stdlib.h> #include "listlib.h" linked_list_t *my_tab_array_to_list(int ac, char * const *av) { linked_list_t *list = NULL; for (int i = 0; i <= (ac - 1); i++) my_add_data_to_list(&...
C
#include<stdio.h> #define M 1000000007 long long int A[1000000]={0}; inline int fastio() { int t=0; char ch; ch=getchar_unlocked(); while(ch<'0'||ch>'9') ch=getchar_unlocked(); while(ch<='9'&& ch>='0') { t=(t<<3)+(t<<1)+ch-'0'; ch...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_highlvl_graphics.c :+: :+: :+: ...
C
//Lab1 //v9malhot 20662020 //y95han 20651352 #include <LPC17xx.h> #include <RTL.h> #include <stdio.h> #include "uart_polling.h" #include "../RTX_CM3/INC/RTL_ext.h" #include <stdlib.h> //prints the state of the task given the integer equiavalent void printState(unsigned int state) { switch (state) { case INACTIVE: ...
C
#include <stdio.h> #include <uv.h> #include <rust_async_executor.h> static void task_wake(RustAsyncExecutorExternTask data) { uv_async_t* handle = data; uv_async_send(handle); } static void task_poll(uv_async_t* handle) { if (rust_async_executor_poll(handle->data)) { printf("task_poll() = true\n")...
C
#include <stdio.h> #include <string.h> int countSetBits(unsigned int n) { unsigned int c; // the total bits set in n for (c = 0; n; n >>= 1) { c += n & 1; } return c; } int main(void) { unsigned int n; printf_s("Enter a positive integer: "); scanf_s("%u", &n); printf_s("%d\n", countSetBits(n)); scanf_s...
C
#include "server.h" #include "threadpool.h" #include "libhttp.h" #include<stdio.h> #include<stdlib.h> #include<assert.h> #include<string.h> #include<unistd.h> #include<arpa/inet.h> /* Basic net operations */ #include<sys/socket.h> /* Socket lib */ #include<sys/types.h> #include<sys/stat.h> #include<netdb.h> ...
C
// wield.c inherit F_CLEAN_UP; int do_wield(object me, object ob); int main(object me, string arg) { object ob, *inv; int i, count; if (!arg) return notify_fail("你要装备什么武器?\n"); if (arg == "all") { inv = all_inventory(me); for (count = 0, i = 0; i < sizeof(inv); i++) ...
C
#include<stdio.h> #include<malloc.h> struct Node { int info; struct Node * next; }; typedef struct Node node; node* create (node*); void traverse (node*); node* swap (node*); int main() { node *start = NULL; start = create(start); traverse(start); start=swap(start); traverse(start); r...
C
/* ** EPITECH PROJECT, 2020 ** zappy_server ** File description: ** File for the bct command */ #include "utils/write_list.h" #include "server.h" #include <stdlib.h> void send_bct_info(data_server_t *data, char **arg, map_t *map, client_t *cli) { char str[200] = {0}; if (cli != data->l_graphical.first) { ...
C
#include<stdio.h> #include<pwd.h> #include <stdlib.h> #include <unistd.h> #include <string.h> int main(){ //Get the password struct of the current user id from the system struct passwd *p = getpwuid(getuid()); //print out user name, user ID and group ID respectively printf("User is: %s\n", p->pw_name); ...
C
#include <stdio.h> int main() { char ch = 'A'; printf ("%c\n",ch); int age=20; printf("%d\n",age); long num = 1000; printf("%d\n",num); printf ("%d\n",sizeof(char)); printf ("%d\n",sizeof(int)); printf ("%d\n",sizeof(short)); printf ("%d\n",sizeof(long)); printf ("%d\n",sizeo...
C
#include <stdio.h> #define MAXBUF 1024 static int count; static int notchar(const char c) { if (c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' ) return 0; return 1; } static void findword(const char *line, const char *dest) { int c, i, j,p; i = j = p = 0; while ( (c = line[p++]) != '\0'){ if (c != dest[0]) ...
C
/* ------------------------------------------------------------------------------------- * The Dining Philosophers problem is a classic multi-process synchronization * problem. The problem consists of five philosophers sitting at a table who do * nothing but think and eat. Between each philosopher, there is a single...
C
float earth[3]; float myState[12]; void init() { earth[0] = 0.64; earth[1] = 0; earth[2] = 0; } void loop() { api.getMyZRState(myState); setPositionTarget(earth,3); DEBUG(("trololololololol")); } float distance(float p1[], float p2[]){ float d = 0; for(int i=0; i < 3; i++){ d += (p2[i]-p1[i])*(p2[i]-p1[...
C
#include<stdio.h> #include<stdlib.h> struct stack { int data; struct stack *next; }; typedef struct stack stack; struct queue { int data; struct queue *next; }; typedef struct queue queue; stack *head = NULL, *temps, *current; queue *front = NULL, *rear = NULL, *temp; void push(int elt) { stack *new = (stack *) m...
C
// // TestaPrimo.c // TestaPrimo // // Created by Ricardo de Carvalho Destro on 12/08/20. // Copyright © 2020 Ricardo de Carvalho Destro. All rights reserved. // #include "TestaPrimo.h" /* Convencao: EhPrimo = 1 se o numero dado 'e primo */ /* EhPrimo = 0 se o numero dado nao 'e primo */ //Algoritmo 1 in...
C
#include "stdio.h" int main() { int a, b, c, d; while( scanf("%d %d %d %d", &a, &b, &c, &d), (a+b+c+d!=0) ){ printf("%d\n", 9*(80 + (a-b>=0?a-b:a-b+40) + 40 + (c-b>=0?c-b:c-b+40) + (c-d>0?c-d:c-d+40) )); } }
C
#include "tests.h" #include "utils.h" #include "solver.h" #include <stdio.h> #include <string.h> void test(char* result); void test_row(int row[WIDTH], int expected_value); void test_column(int column[HEIGHT], int expected_value); void test_sub(int sub[SUB_HEIGHT][SUB_WIDTH], int expected_value); void test_rows(int ma...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_suurballe_algorithm.c :+: :+: :+: ...
C
/*Copyright © 2020- by Wangchuwen,2018202114. All rights reserved*/ #include <stdio.h> #include <pthread.h> #include <time.h> #include <unistd.h> #include<semaphore.h> #include <stdlib.h> //semaphores sem_t mutex1,mutex2,mutex3,mutex4;//用于原子操作 sem_t mread,mwrite,mRead,mWrite;//用于读写互斥 int writecount,readcount,Writecount...
C
#include<stdio.h> void NhapMang(int A[100], int N){ int i; for(i=0; i<N; i++){ printf("Mang[%d] = ", i); scanf("%d", &A[i]); } } long GT(int n){ int i; long gt=1; for(i=2; i<=n; i++){ gt *= i; } return gt; } int main(){ int A[100], n; printf("Nhap so phan tu mang: "); scanf("%d", &n); ...
C
/** Autor: Gabriel Dias **/ /** * Dada uma matriz qualquer, verificar se existem elementos repetidos dentro dela. **/ // Bibliotecas padrao #include <stdio.h> #include <locale.h> // Define valores que sero usados no programa #define MAX 100 #define TRUE 1 #define FALSE 0 int main() { // Configura o idioma de aco...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* argument.c :+: :+: :+: ...
C
// // Created by hasee on 2019/12/2. // #include "gcd_lcm.h" int gcd(int a, int b) { if (a <= 0 || b <= 0) return -1; while (b != 0) { int tmp = a % b; a = b; b = tmp; } return a; } int lcm(int a, int b) { return a * b / gcd(a, b); }
C
#include<stdio.h> #include<sys/wait.h> #include<unistd.h> #include<sys/types.h> #include<stdlib.h> #include<pthread.h> void mysys(char *command){ pid_t pid; if((pid = fork()) == 0){ execl("/bin/sh","sh","-c",command,NULL); } waitpid(pid,NULL,NULL); } int main(){ printf("--------------...
C
#include <stdio.h> //biblioteca padro para comandos i/o #include <stdlib.h>//necessrio para o system ("pause") main() { int op; float v1, v2,conta; printf("\nDigite o primeiro valor: \n"); scanf("%f", &v1); printf("\nDigite o segundo valor: \n"); scanf("%f", &v2); printf("\nDigite um numero ...
C
//power of 8 #include <stdio.h> int main() { int n; printf("Enter the number:"); scanf("%d",&n); if(((n&(n-1))==0) && ((n&0xB6DB6DB6)==0)) printf("Power of 8\n"); else printf("Not Power of 8\n"); }
C
#include "binary_trees.h" /** * binary_tree_height - Returns the height of the binary tree * @tree: the binary tree * Return: the height of the binary tree */ size_t binary_tree_height(const binary_tree_t *tree) { size_t height_left = 0, height_right = 0; if (!tree) return (0); if (!tree->left && !tree->right) ...
C
//DANIEL VIDIRI NETO - 109970 //TAREFA 02 - URI1002 //DATA 04/08/2020 #include <stdio.h> int main() { double area, raio, n; n = 3.14159; scanf("%lf", &raio); area = n * (raio * raio); printf("A=%.4lf\n", area); return 0; }
C
//////////////////////////////////////////////////////////////////////////////// //INCLUDES #include <stdio.h> int main(void) { float sum = 0; float height = 0; float radius = 0; int count = 0; int i = 0; printf("How many cylinders would you like to sum?\n"); scanf("%i", &count); for(i = 0; ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <limits.h> #define SCHEME_CREATE_MAIN #define SCHEME_ASSERT_STDINOUT_ARE_PIPED #define SCHEME_FUNCTION graph_ttc_performance #include "scheme.h" int graph_ttc_performance(int argc, char ** argv, FILE * pipe_in, FILE * pipe_out, FILE * pipe_err) { ...
C
/* ============================================================================ Name : parcial1Labo1.c Author : Luca Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #include ...
C
/**@file * Interface of gamma game input parser. * * @author Antoni Koszowski <a.koszowski@students.mimuw.edu.pl> * @copyright * @date 17.05.2020 */ #ifndef GAMMA_GAMMA_PARSER_H #define GAMMA_GAMMA_PARSER_H /**@brief Parses and interprets input. * Parses input lines and then interprets it. * In case that comma...
C
#include<stdio.h> int insert(int a[],int n,int index,int element){ int i=0; for(i=n;i>index;i--) a[i]=a[i-1]; a[i]=element; return n+1; } int delete(int a[],int n,int index){ for(int i=index; i<n; i++){ a[i]=a[i+1]; } return n-1; } void display(int a[],int n){ for(int i=0;i<n;i++) printf("%d ",a[i]); pr...
C
#include "redBlackTree.h" #include <stdio.h> #define N 50 int main( ) { rbTree T; position P; int i; int j = 0; T = init( ); T = makeEmpty( T ); for( i = 1; i < N; i++ ) T = insert( i, T ); printf( "Inserts are complete\n" ); printTree(T); printf("\nroot value is %...
C
/** * @file LineSeperator.h * @author Idan Refaeli <idan.refaeli@mail.huji.ac.il> * @version 1.0 * @date 03 Aug 2015 * * @brief Perceptron program. Flagging given data by 1 or -1 using linear separator. * Header file for perceptron.c. * * @section LICENSE * This program is a free software * * @section...
C
#include "stm32f4xx.h" void LED_Init(void) { RCC_AHB1PeriphClockCmd (RCC_AHB1Periph_GPIOD, ENABLE); GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO...
C
/* * SwitchTime.c * * Created: 2020-06-15 오전 10:21:12 * Author: PKNU */ #include <avr/io.h> #include <util/delay.h> int main() { unsigned char Switch_flag = 0; unsigned char Switch_flag_pre = 0x01; // 0000 0001 최초 delay DDRA = 0x0F; // 0000 1111 0~3번 출력 DDRD = 0x00; // 0000 0000 D입력 PORTA = 0x00; //...
C
#include "special_arg.h" #include "dev_list.h" #include "wire_io.h" #include "wire_log.h" #include <string.h> #include <errno.h> #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) static int special_arg_net(char **items, unsigned items_size, unsigned item_size) { struct ifaddrs *ifaddr; struct ifaddrs *ifa; int ret;...
C
/* Environmental Data Sensing and Storing mscs crysanthus@gmail.com */ #include <SoftwareSerial.h> #include <Adafruit_Sensor.h> #include <DHT.h> #include <DHT_U.h> #include <Wire.h> #include <BH1750FVI.h> SoftwareSerial homeStatESP(6, 7); // RX, TX // ESP Module DHT_Unified dhtSensor(2, DHT11); /// DHT sensor ...
C
#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/fs.h> #include <linux/time.h> MODULE_LICENSE("GPL"); MODULE_AUTHOR("chudik"); static const unsigned long chudFS_MAGIC_NUMBER = 0x13131313; static void chudFS_put_super(struct super_block *sb) { printk(KERN_INFO "chudFS s...
C
/*********************************************************************** * $Id: stringtable.c,v 1.1 2012/12/05 07:59:55 dmf Exp $ * Derek Frank, dmfrank@usc.edu * * NAME * stringtable.c - implementation file for the string table ADT * * DESCRIPTION * Implementation for the string table ADT. The string tabl...
C
#include <errno.h> #include <stdio.h> #include <fcntl.h> #include <netdb.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #include <arpa/inet.h> #include <sys/socket.h> #include <netinet/in.h> int main(int argc, char** argv) { int n; int m; int fd; int soc...
C
/// \file /// Utilities for working with timespecs. #pragma once #include <assert.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #ifdef __cplusplus extern "C" { #endif /// Return a timespec with zero seconds and zero nanoseconds. struct timespec timespec_null(); /// Add \p rhs ...
C
/* Author: lab * Partner(s) Name: * Lab Section: * Assignment: Lab 10 Exercise 4 * Exercise Description: [optional - include for your own benefit] * * I acknowledge all content contained herein, excluding template or example * code, is my own original work */ #include "timer.h" #include <avr/io.h> #ifdef _SIM...
C
#include<stdio.h> #include<stdlib.h> #include<math.h> int main() { long int b= 0, octal, place = 1, r; int OCT[] = {0, 1, 10, 11, 100, 101, 110, 111}; printf("Enter the octal Value:\n"); scanf("%ld",&octal); do { r = octal % 10; b += (OCT[r]*place); octal = octal / 10; place *= 1000; } while(octal > ...
C
/* ** EPITECH PROJECT, 2018 ** PSU_zappy_2017 ** File description: ** map_create.c */ #include "map.h" void empty_tile(tile_t *tile, size_t food) { (*tile)[FOOD] = food; (*tile)[LINEMATE] = 0; (*tile)[DERAUMERE] = 0; (*tile)[SIBUR] = 0; (*tile)[MENDIANE] = 0; (*tile)[PHIRAS] = 0; (*tile)[THYSTAME] = 0; (*tile...
C
#include<stdio.h> void main(){ int c; int blank=0; int tab=0; int newline=0; while((c=getchar())!=EOF){ if(c==' ') blank++; if(c=='\t') tab++; if(c=='\n') newline++; } printf("no of blanks %d\n",blank); printf("no of tabs %d\n",tab); printf("no of new lines %d\n",newline); }