language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/** * greedy.c * * Soumya Mondal * tyson.granger181@gmail.com * * CS50 Pset 1 */ # include<stdio.h> # include<cs50.h> # include<math.h> int main(void) { // Ask user for a input and verify if input is positive printf("How much change is owed?\n"); float user_input = GetFloat(); while(user_in...
C
#include "insertion_sort.h" void insertion_sort(int list[], int n) { int num = 0x00; int i, j; for (i = 1; i < n; i++){ num = list[i]; for (j = i-1; j >= 0 && num < list[j]; j--){ list[j+1] = list[j]; } list[j+1] = num; } return; } int main(void) { int list[5] = {9, 5, 3, 2, 8}; int size = size...
C
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * Se incluyen algunas rutinas modificadas de Numerical Recipes in C, * entre las que se encuentran reporte de errores, declaracion y * y liberacion de arreglos y matrices * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * #include <stdlib.h> #include...
C
#include <unistd.h> #include <errno.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #define MAXSIZE 1024 int main() { ssize_t size; char buffer[MAXSIZE]; while((size = read(STDIN_FILENO,buffer,MAXSIZE)) > 0){ if(write(STDOUT_FILENO,buffer,size) != size){ pe...
C
/* * @Author: Weijie Li * @Date: 2018-06-21 22:50:06 * @Last Modified by: Weijie Li * @Last Modified time: 2018-06-21 22:50:11 */ #include <math/matrix_utils.h> #include <assert.h> #define VERBOSE 0 #define DUMP_MAT(x) if (VERBOSE) {DumpMatGf2(x);} int combined_affine_init(CombinedAffine *cm, int sub_matrix_si...
C
/* Sudoku Solution Validator */ /* SHIVAM SINGH */ #include<pthread.h> #include<stdlib.h> #include<stdio.h> /*Example Of a Valid Sudoku Given in Book*/ int sud[9][9]={...
C
/* * By Spacebody * * * Implement the queue in circle by array * */ #include <stdio.h> #include <stdlib.h> #ifndef _QueueArray_h typedef struct QueueRecord *Queue; typedef int ElemType; #define MinQueueSize 5 int IsEmpty(Queue Q); //exam whether it is empty int IsFull(Queue Q); //exam whether it is full...
C
/** * @file * @brief Install and uninstall distributions */ #pragma once #include "lickdir.h" #include "llist.h" #include "menu.h" #include "uniso.h" /** * @brief information about an installed distribution */ typedef struct installed_t { /// the distribution id char *id; /// the distribution human-...
C
#include<stdio.h> int main(){ int a = 2,b=2; if(&a != &b){ printf("Equal\n"); } return 0; }
C
#include <stdio.h> main() { printf("Content-Type: text/html\n\n"); printf("<H1>TITLE</H1>\n"); printf("Hello from C language\n"); }
C
#include<stdio.h> #include<limits.h> int main() { printf("Here are the ranges - \n"); printf("char- %d to %d\n",CHAR_MIN,CHAR_MAX); printf("short- %d to %d\n",SHRT_MIN,SHRT_MAX); printf("int- %d to %d\n",INT_MIN,INT_MAX); printf("long- %ld to %ld\n",LONG_MIN,LONG_MAX); printf("signed char- %d t...
C
#ifndef AVL_H #define AVL_H typedef struct avl_node_s avl_node_t; typedef struct avl_s avl_t; struct avl_node_s { int value; int height; // height of the subtree rooted at this node avl_node_t *link[2]; // pointers to left child and right child }; struct avl_s { avl_node_t *root; }; // core function...
C
#include <stdio.h> #include <cs50.h> #include <string.h> #define _XOPEN_SOURCE #include <unistd.h> char *crypt(); // If the encrypted key equals the given hash, that key is the password (so terminate the program) void compare(char key[], char salt[], char hash[]); // If the encrypted key equals the given hash, th...
C
/*Faa um programa que receba: Quantidade de homens. Quantidade de mulheres. Quantidade de crianas. Quantidade de horas de durao de um churrasco. Calcular e mostrar uma lista de compra de 10 itens para um churrasco, considerando a quantidade de pessoas e a durao do churrasco. A lista de compras dever constar: ...
C
#include <criterion/criterion.h> #include <errno.h> #include "client_conn.h" /* Assert that we can construct and destroy a client_conn */ Test(client_conn, test_new_destroy) { struct client_conn *conn = client_conn_new(NULL, 0); cr_assert(conn != NULL); client_conn_close(&conn); cr_assert(conn == NUL...
C
#ifndef _LCD_H_ #define _LCD_H_ #include "GPIO.h" #include "SClk.h" /** * @def MASK_BIT_LCD Mascara para iniciar os bits de output do GPIO para interagir com o LCD */ #define MASK_BIT_LCD 0x3F00 /** * @def MASK_LOW Mascara para retirar a parte baixa de um caracter */ #define MASK_LOW 0x0F /** * @def MASK_HIGH Masca...
C
#include "http_post.h" static const char *TAG = "server station"; QueueHandle_t task_Queue = NULL; // Look at website: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/protocols/esp_http_server.html /* Our URI handler function to be called during GET /uri request */ esp_err_t get_handler(htt...
C
#include <stdlib.h> #include <stdio.h> #include "dames.h" #include "dames_intermediate.h" struct game *new_game(int xsize, int ysize){ // On alloue de la mémoire pour créer la structure du jeu struct game *jeu = (struct game *) malloc(sizeof(struct game)); if(jeu == NULL){ // Si le malloc a échoué printf("Mémoir...
C
/* ** search.c for search sources in /home/styvaether/Epitech/PSU/PSU_2015_malloc/src ** ** Made by Nicolas Gascon ** Login <styvaether@epitech.net> ** ** Started on Sat Jan 30 17:32:53 2016 Nicolas Gascon ** Last update Sun Feb 14 21:56:00 2016 Nicolas Gascon */ #include "../include/rbtree.h" /* ** Work in progre...
C
/* * Banner.c * This example demonstrates several important points. It uses the Win32 Console API * instead of common stdio functions, including alternatives to cursor handling and * gets(). * * 1) The primary thread allocates memory with HeapAlloc() and the worker thread frees * the memory with HeapFr...
C
/*Вывести числовой квадрат заданного размера. Выведенные числа начинаются с единицы и постоянно увеличиваются. В каждой строке числа разделены пробелами. Размер считать с клавиатуры. Пример ввода 2 Пример вывода 1 2 3 4*/ #include <stdio.h> int main() { int size; int value = 0; scan...
C
#include <unistd.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #define BUF_SIZE 8192 char buffer[BUF_SIZE]; ssize_t read_to_buffer() { ssize_t bytes = read(0, buffer, BUF_SIZE); if (bytes < 0) { printf("failed to read\n"); exit(1); } return bytes; ...
C
#include<stdio.h> #include<math.h> main(){ float x1,x2,y1,y2,distance; printf("veuillez entrer les coordonnes de A(x et y):\n"); scanf("%f%f",&x1,&y1); printf("veuillez entrer les coordonnes de B(x et y) : \n"); scanf("%f%f",&x2,&y2); distance=sqrt(pow((x1-x2),2)+pow((y1-y2),2)); p...
C
Train Journey - Initial Boarding Count In a train journey, there are N stations between station A and B (The train starts from station A). The number of passengers who alighted in station B is passed as the input. The number of passengers who alighted and boarded in the N stations in between is also passed as the inpu...
C
#include<stdio.h> #include <unistd.h> /* Our structure */ struct rec { int x,y,z; }; int main(int argc,char* argv[]) { /* This is a mock binary that simulates a binary that processes jpg files. In particular it processes files that have the four magic bytes 0xFF0xD80xFF0xE0. */ unsigned char ...
C
// // Created by 范兴国 on 2019-10-28. // #include <stdlib.h> #ifndef DSC_STACK_NUM_H #define DSC_STACK_NUM_H #endif //DSC_STACK_NUM_H #define SN 20 #define DataType float typedef struct{ DataType data[SN]; int top; }Stack_float; void initStack_float(Stack_float *ST){ ST->top=-1; } void Push_float(Stack...
C
#include <stdio.h> int main(){ char c; printf("Enter a character: "); scanf("%c", &c); if (c >= 97 && c <= 122){ printf("Character is Lowercase\n"); } else if (c >= 65 && c <= 90) { printf("Character is Uppercase\n"); } else { printf("Invalid Character\n"); } re...
C
#include <stdio.h> #include <conio.h> #include <stdlib.h> int main (){ int vetx[]={1,02,38,14,55,96,73,87,9,10}; int x,y,i=0,k=0; printf ("digite valor que serar pesquisado no vetor: "); scanf("%d",&x); for(y=0;y<=9;y++){ if (x == vetx[y]){ i=1;} if (x == vetx[y]){ break; } } ...
C
#include <conio.h> #include <stdio.h> #include <stdlib.h> #include <locale.h> main() { system("color f1") ; setlocale(LC_ALL,"") ; int tipoDVD, dia ; float DVDCOMUM = 5.0 , DVDLANCAMENTO = 5.75 ; //esses valores so aleatrios, poderiam ser quaisquer outros. ...
C
/* Scrivere un programma C “scrivi.c” che utilizzando la funzione primitiva “write”, scriva in un file “alfabeto.txt” la seguente stringa di caratteri: “ABCDEFGHILMNOPQRSTUVZ” */ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <string.h> #include <unistd.h> int main(int argc, char const *argv[]){ ...
C
#include "sortingMethods.h" void mergeSort(int input_arr[], int arr_size); /* Function to print an array */ void printArray(int arr[], int size) { int i; printf("["); for (i=0; i < size; i++) printf("%d ", arr[i]); printf("]\n"); } // A utility function to swap two elements void swap(int...
C
/*#include <stdio.h> #include <stdlib.h> #define MAX_SIZE 10 int main() { int arr[MAX_SIZE] = { 69, 10, 30, 2, 16, 8, 31, 22, 13, 31 }; int temp, key, j; printf(" : "); for (int k = 0; k < MAX_SIZE; k++) { printf("%d ", arr[k]); } printf("\n"); printf("<<<<< >>>>> \n"); for (int i = 0; i < MAX_SIZE; ...
C
/* Print the context information of FILENAME, and return true iff the context could not be obtained. */ static bool ATTRIBUTE_WARN_UNUSED_RESULT out_file_context (char *pformat, size_t prefix_len, char const *filename) { char *scontext; bool fail = false; if ((follow_links ? getfilecon (filename, &sco...
C
#define _CRT_SECURE_NO_WARNINGS 1 float a = 12.5 ᱨ12.5Ĭdoubleͣ float a = 12.5f long a = 10L дΪ10l ############################################################################### 2019 - 10 - 9 shift + Ҽ 㿪powershellڱ ջȽ 쳣ʱ쳣 ʱ쳣 ע⣺쳣ʱ򽫲ִСͣmain 쳣ϸ / ĸһΪ0ᷢ쳣 %: ԶС 10.0%1.5 1.0 ԶԸ ++ int a = 10; a = a++; System.out.pr...
C
#include <p18cxxx.h> #include <delays.h> #include <sw_i2c.h> far unsigned char I2C_BUFFER; // temp buffer for R/W operations far unsigned char BIT_COUNTER; // temp bufffer for bit counting /******************************************************************** * Function Name: unsigned int SWReadI2C(void) ...
C
#include <stdio.h> void selection_sort(int a[], int n) { int i, j, k; for (i = 0; i < n - 1; i++) { k = i; for (j = i + 1; j < n; j++) { if (a[k] > a[j]) k = j; } if (k != i) { int tmp = a[i]; a[i] = a[k]; a[k] = tmp; } } }
C
/*******************************************************************/ /* slibtool: a skinny libtool implementation, written in C */ /* Copyright (C) 2016--2021 SysDeer Technologies, LLC */ /* Released under the Standard MIT License; see COPYING.SLIBTOOL. */ /***************************************...
C
#pragma once #include <Windows.h> typedef struct __uint128 { unsigned __int64 LowPart; unsigned __int64 HighPart; __uint128(__int64 init_x64Var) { this->LowPart = init_x64Var; this->HighPart = NULL; } __uint128& operator=(__uint128 a) { LowPart = a.LowPart; HighPa...
C
#include <R.h> #include <Rdefines.h> #include "SynExtend.h" /* * Author: Aidan Lakshman * Contact: AHL27@pitt.edu * * This is a set of C functions that apply an R function to all internal * nodes of a dendrogram object. This implementation runs roughly 2x * faster than base `stats::dendrapply`, and deals with de...
C
#include "pocklington.h" #define LIMIT sizeof(primes) / sizeof(unsigned int) //Tableau de nombres premiers pour la recherche de a const unsigned int primes[] = { 2,3,5,7,11,13,17,19,23,29, 31,37,41,43,47,53,59,61,67,71, 73,79,83,89,97,101,103,107,109,113, 127,131,137,139,149,151,157,163,167,173, 179,181,191...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int par(int a[],int low,int heigh) { int i = low; int j = heigh; int temp = a[i]; while(i < j) { while(j > i && a[j] >= temp) j--; a[i] = a[j]; while(i < j && a[i] < temp) i++; a[j] = a[i]; } a[i] = temp; return i; } void quickSort(int a...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> long long findNb(long long volume) { int length = 0; while (volume >= 0) { if (volume == 0) { return length; } length++; volume -= pow(length, 3); } return -1; }
C
/* INPUT FORMAT: 3 <- The number of students Joe Math990112 89 <- Name IDNumber Grades apiece listed Mike CS991301 100 Mary EE990830 95 OUTPUT FORMAT: Mike CS991301 Joe Math990112 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_SIZE 200 // When the MAX_SIZE was c...
C
#include <stdlib.h> #include <stdio.h> #include <strings.h> #include <sys/timeb.h> #include "library.h" void random_array(char *array, long bytes){ for (int i = 0; i < bytes; i++){ array[i] = 'A' + (rand() % 26); } } int get_histogram(FILE *file_ptr, long hist[], int block_size, long *milliseconds, ...
C
#include "monty.h" /** * get_op_func - function to select correct operation function * @token1: 1st bytecode input (opcode) * Return: pointer to correct operation function */ void (*get_op_func(char *token1))(stack_t **stack, unsigned int line_number) { instruction_t instruction_s[] = { {"pop", pop}, {"pall",...
C
#include<stdio.h> int main() { int ddoDDo = 70; int ggoGGo = 30; int exchange; int haveMoney = 1000; int a = ddoDDo * 2; int b = ggoGGo * 3; int num500, num100, num50, num10, temp; printf("ǶǸ ü ݾ : %d\n", a); printf("Dzǹ ü ݾ : %d\n", b); exchange = haveMoney - a - b; printf("Ž : %d\n", exchange); pri...
C
#include "pair.h" #include <stdio.h> #include <stdlib.h> typedef struct E { int key, value; } E; typedef struct R { int sum, a, b; } R; static int cmpE(const void *x, const void *y) { E *a = (E *) x, *b = (E *) y; if (a->key < b->key) return -1; if (a->key > b->key) return 1; if (a->value < b->value) return -1...
C
#include "gdb.h" #include <stdio.h> void insert_breakpoint(t_env *e) { t_node_break *curr = e->lst_break.begin; while(curr) { long tmp = ptrace(PTRACE_PEEKDATA, e->child, curr->addr, NULL); curr->opcode = tmp & 0b11111111; // printf("opcode -> 0x%x at addr -> 0x%lx\n", curr->opcode, curr->addr); tmp = tmp -...
C
//airplane queue #include<stdio.h> #include<stdlib.h> #include<string.h> #define N 4 int rear=-1; int front=-1; struct plane { char name[10]; }; struct plane arr[N-1]; int isempty() { if(rear==-1 && front==-1) return 1; else return 0; } int isfull() { if((rear+1)%N==front) return 1; else return 0; } vo...
C
#include <signal.h> #include <stdio.h> #include <unistd.h> void hand(int signum){ signal(SIGINT, SIG_DFL); printf("press again ctrl + c\n"); } struct sigaction action; int main(){ action.sa_handler = SIG_IGN; sigaction(SIGINT, &action, NULL); sigaction(SIGQUIT, &action, NULL); printf("ignorin...
C
/* ============================================================================ Name : Tp_[1].c Author : Molinari German Description : Calculadora ============================================================================ */ #include <stdio.h> #include <stdlib.h> #include "bibliotecaTp1.h" int mai...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { char *s1 = "Hello World!\n"; //s1[0] = 'h'; // runtime error; printf(s1); return 0; }
C
#include "../Headers/huff_tree.h" node* create_node() { node* new_node = (node*) malloc(sizeof(node)); new_node->priority = 0; new_node->left = NULL; new_node->right = NULL; new_node->next = NULL ; return new_node; } //PEGA OS 2 CARACTERES DE MENOR FREQUÊ...
C
#ifndef _NBL_LEDS_H_ #define _NBL_LEDS_H_ #include "nbd/leds.h" static inline const char * nbl_leds_state_cstr(enum led_state state) { char* ret = NULL; if(state == led_state_off) { ret = "off"; } else if(state == led_state_on) { ret = "on"; } else if(state == led_state_unchanged) { ret = "unchanged";...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print_stacks.c :+: :+: :+: ...
C
#include <include/types.h> #include <include/task.h> #include <include/limits.h> #include <include/string.h> #include <include/system.h> #include <include/stdarg.h> #include <include/io.h> #include <dev/console.h> #include <mm/memory.h> #define _PUSH(esp, value) do{ \ (esp)-=sizeof(u32); \ *(u32*)(esp)=value; ...
C
#include "HeaderTrabalho.h" #define x3 5000 #define x4 50000 #define x5 500000 int main() { //vetores principais não modificados durante a execução das funçoes int v1[x3],v2[x4],v3[x5]; //vetores auxiliares modificados durante a execução das funçoes int x,vaux1[x3], vaux2[x4], vaux3[x5], indice;...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* check_file.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <locale.h> /* */ int main(int argc, char *argv[]) { system ("color 0a"); setlocale(LC_ALL, "Portuguese"); float denominador, numerador, soma = 0.0, n; printf ("Insira um nmero inteiro positivo n:\n"); scanf ("%f", &n); if (n <= 0.0){ printf ("Erro...
C
#include <avr/pgmspace.h> #include <util/delay.h> #include <stdlib.h> #include <string.h> #include "lib/enc28j60.h" #include "lib/ethernet.h" #include "config.h" #include "net.h" /** * Note: Network Packets Headers (Ethernet II) * Basics: * [14 bytes] Ethernet II header * [20 bytes] IPv4 header * [.. bytes] TCP...
C
#include "memlib.h" #include "memlib_ext.h" #include "../drv/display.h" #include "../drv/hwio.h" #include "bitmap.h" #define E820_LOC 0x10000 #define E820_COUNT_LOC 0x1400 #define K_PAGE_SIZE 40 unsigned int lowMemSize = 0x0; unsigned int highMemLocation = 0x0; unsigned int highMemSize = 0x0; unsigned int bucketStar...
C
/* Calculates fibonacci's sequence using recursion. As the sequence starts like so: 0, 1, 1, 2 We hande this by checking index against specific values Otherwise we want to check above a 1th index Formulae: (index - 1) + (index - 2) Else return -1 (as per pdf) */ int ft_fibonacci(int index) { if (index == 0) return...
C
//program to print only unique elements present in an array. //this program takes 2.844s for 10million random inputs. #include<stdio.h> #include<stdlib.h> #include<math.h> #include<time.h> #include<inttypes.h> #define ENABLE_DEBUGGING #define HASH_CELL_SIZE 1000 #define HASH_TABLE_SIZE 1000 #define SIZE 10 //cell f...
C
//Anupreet Singh roll no.11911063 #include<stdio.h> #include<stdlib.h> //Structure of Tree struct tree{ int data; struct tree *left; struct tree *right; }; //Creating a new tree node struct tree *newNode(int data){ struct tree *node = (struct tree*)malloc(sizeof(struct tree)); node->data = data; ...
C
#include <stdio.h> #include <omp.h> int main(){ double start=omp_get_wtime(); usleep(1000); double end=omp_get_wtime(); double wtick=omp_get_wtick(); printf("start=%.16g\nend=%.16g\ndiff=%.16g\n",start,end,wtick); return 0; }
C
#include "libft.h" static char *tmp_line_return(char **line, int n, char **buffer) { char *tmp; tmp = NULL; tmp = malloc((n + 1) * sizeof(char)); if (!tmp) return (NULL); tmp = ft_tmpcpy(tmp, *line, n); *line = ft_strtrim(*line, n); if (!*line) { free (*buffer...
C
/* adder.c * demonstrate the use of GetInt, from CS50 Library * 09/25/2013 * bagustris, bagustris@yahoo.com */ #include <cs50.h> #include <stdio.h> int main(void) { //ask for user input printf("Give me an integer:"); int x = GetInt(); printf("Give me another integer:"); int y = GetInt(); //do math ...
C
#include <stdio.h> #include <stdlib.h> #define MAX 10 #define TRUE 0 #define FALSE -1 struct queue { int items[MAX]; int front, rear; int size; }; void create(struct queue *pq) { pq->front = pq->size = 0; pq->rear = MAX - 1; } int isFull(struct queue *pq) { return ((pq->size == MAX) ? TRUE : FALSE) ; }...
C
/** * Copies a BMP piece by piece, just because. * with resize * * more comfortable version */ #include <stdio.h> #include <stdlib.h> #include "bmp.h" const int SIZE_OF_HEADER=54; const int SIZE_OF_BMP_INFO=40; const int BITS_PER_PIXEL=24; const int NO_COMPRESSION=0; const int PARAGRAPH_WIDTH=4; const in...
C
/* ** EPITECH PROJECT, 2018 ** my_getnbr ** File description: ** */ int my_getnbr(char const *str) { int i = 0; if (str[i] > 48 && str[i] < 57) { my_putchar(str[i]); i++; } if (str[i] >= 9 && str[i] <= 13 || str[i] == 32) { my_putchar(str[i]); i++; } else { retur...
C
#include <stdio.h> int main(void){ int n1,n2,n3,n4; double d1,d2,d3,d4; n1=5/2; n2=5.0/2.0; n3=5.0/2; n4=5/2.0; d1=5/2; d2=5.0/2.0; d3=5.0/2; d4=5/2.0; printf("n1=%d\n",n1); printf("n2=%d\n",n2); printf("n3=%d\n",n3); printf("n4=%d\n\n",n4); printf("d1=%lf\n",d1); printf("d2=%lf\n",d2); printf("d3=...
C
#include<stdio.h> #include<stdlib.h> #include<stdbool.h> #define N 100 int stack[N]; int top=-1; int ctr=0; void push(int item) { stack[++top]=item; } int pop() { return stack[top--]; } int peek() { return stack[top]; } bool isEmpty(){ return top==-1; } void addEdge(int v,int adjMatrix[][v],int start,in...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <time.h> #define EV_MSC 0x04 #define MSC_GESTURE 0x02 #define WAKE_TIME 2 #define INPUT_DEVICE "/dev/input/by-path/platform-f9924000.i2c-event" struct input_even...
C
#include<stdio.h> #include<math.h> int main( int argc, char const* argv []){ int j=4, e, signo=1; double pi, suma; for(e=1; e<=99999; e+=2){ suma= signo*((double)j/e); pi = pi + suma; signo= signo* -1; } printf("Pi es: \n%1.54f", pi); return 0; }
C
#include"my_pthread_rwlock2.h" #include<unistd.h> #include<string.h> //验证读优先 my_pthread_rwlock_t rwlock=MY_PTHREAD_RWLOCK_INITIALIZER; void* thread1(void* arg) { my_pthread_rwlock_wrlock(&rwlock); printf("I an the thread1 wrlock\n"); printf("thread1 is in wrlock!\n"); sleep(2); printf("thread1 is wake up!\n"); ...
C
/* * GCC file */ #include <pthread.h> #include <stdio.h> #include <time.h> #include <stdlib.h> #define BIG_NUM 600000000LL static void *do_nothing_loop(void *d) { volatile long long * a; a = (long long *) d; while(*a < BIG_NUM) ++*a; return NULL; } int main() { pthread_t thread[2]; long lo...
C
/*Write a program to read the following data as it is and display on the screen by using scanf() and printf() function: �Ram� 120 �a� 123.2.*/ #include<stdio.h> int main() { char alpha; printf("\nEnter the aplphabet "); scanf("%c",&alpha); printf("\nThe alphabet you enter is %c",alpha); }
C
#include <Python.h> #include <numpy/arrayobject.h> #include <numpy/ndarrayobject.h> #include <numpy/noprefix.h> static PyObject *test_transpose(PyObject *self, PyObject *args) { PyObject *input, *output; // Declaration group intp *dimsin; intp *dimsout; intp *SIZE; void *output_data; int type; int ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include<sys/wait.h> #define PARAMS // this allows running commands with paramenters, but still limited to foreground execution #define MAX_ARGS 128 //#define AUDIT int gets(char*); char* s = " "; int main(int argc, char** argv) { ...
C
///////////////////////////////////////////////////////////////////////////////////////////////////// // Write a program which accept two numbers from user and display position // of common ON bits from that two numbers. // Input : 10 15 (1010 1111) // Output : 2 4 // Author : Annaso Chavan ///////////////////////////...
C
/******************************************************** * Filename: core/comm.c * * Author: jtlim, RTOSLab. SNU. * * Description: message queue management. ********************************************************/ #include <core/eos.h> void eos_init_mqueue(eos_mqueue_t *mq, void *queue_start, int16u_t queu...
C
/***************************************************************************** * tile.c . . . * * Methodes to deal with DTED files and tiles, the . . /\ . . * * memory representation of a DTED file . / \ . /\ .* * ...
C
/* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved. * * The information contained herein is property of Nordic Semiconductor ASA. * Terms and conditions of usage are described in detail in NORDIC * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. * * Licensees are granted free, non-transferable use...
C
/************************************************************************/ /* The code creates a balanced binary tree. */ /* The code has been tested by a little data, so it can not ensure */ /* that it can deal with all case!!!. */ /* The data for te...
C
#include <ruby.h> // Allocate a variable for the factorial module. Ruby values are all of type VALUE. Qnil is the C representation of Ruby's nil. // The Ruby module where the fast_fibonacci will reside is called egotistically MyMath VALUE MyMath = Qnil; // This is the module that will be responsible for fast computati...
C
// Sudoku Guesser //#include <stdlib.h> #include <stdio.h> #include "header.h" int main(int argc, char const *argv[]) { int sudoku[9][9]; FILE *fp; fp = fopen(argv[1], "r"); char c; for (int i = 0; i < 9; ++i) { for (int j = 0; j < 9; ++j) { c = fgetc(fp); if (c == ...
C
/* This program illustrates the use of the vfork() system call to create a child process. The vfork() is an * optimization over the fork() call in that it does not replicate the parent's text and data regions in the * child's address space. The parent and child reference the same data and text regions. * * Author...
C
/* $Id: Loading.C,v 1.28 2005-08-01 21:58:35 wilsonp Exp $ */ /* (Potential) File sections: * Service: constructors, destructors * Input: functions directly related to input of data * xCheck: functions directly related to cross-checking the input * against itself for consistency and completeness * Preproc...
C
/*========================================================= 8-2-4 OjMk Fib_Search() OjM禡 a[ARR_NUM] jM ARR_NUM jMƼƥ(}Cjp) ========================================================= */ #include <stdio.h> #include <stdlib.h> #de...
C
/* * Interrrupts.c * * Created: 7/25/2021 2:45:21 PM * Author : ferez */ //If F_CPU not defined #ifndef F_CPU //Because ATMEGA128 runs at 16MHz , UL - Unsigned Long #define F_CPU 16000000UL #endif #define PORT_LED0 PORTC #define PIN_LED0 PINC0 #define PORT_LED1 PORTC #define PIN_LED1 PINC1 #define SWITCH_K0 ...
C
#include<stdio.h> int main() { double s0, v0, t; printf("Digite os valores de s0, v0 e t, respectivamente: "); scanf("%lf %lf %lf", &s0, &v0 &t); return 0; }
C
#include <stdio.h> #include <string.h> #include <malloc.h> #include <stdlib.h> int main() { char *buffer = NULL; size_t bufsize = 32; size_t characters; buffer = (char *)malloc(bufsize * sizeof(char)); if (buffer == NULL) { exit(1); } printf("Type something: "); characters = ...
C
//Price Shoemaker - Systems II - DePaul /*-------------------------------------------------------------------------* *--- ---* *--- stringLangServer.c ---* *--- ---* *--- This file defines a C program that gets file-sys commands ---* *--- from client via a socket, executes those commands i...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* push_swap.h :+: :+: :+: ...
C
#include <stdio.h> int main (void) { void scalarMultiply (int matrix[3][5], int scalar); void displayMatrix (int matrix[3][5]); int sampleMatrix[3][5] = { {7,16, 55, 13, 12}, {12,10,52,0,7}, {-2, 1, 2, 4, 9} }; printf("Original matrix:\n"); displayMatrix (sampleMatrix); scalarMultiply (sa...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_split.c :+: :+: :+: ...
C
#include <stdio.h> int swap_count = 0; int shift_count= 0; void swap(int *a, int *b) { int temp; temp = *a; *a = *b; *b = temp; swap_count++; } void print_ar(int ar_size, int * ar) { int i; for(i = 0; i < ar_size; i++) { printf("%d ", ar[i]); } } int insertionSort(int ar_size...
C
#include "future.h" #include "err.h" typedef void *(*function_t)(void *); typedef struct runnable_arg { struct callable callable; struct future *future; } runnable_arg_t; typedef struct map_arg { struct future *from; void *(*mapping_fn)(void *, size_t, size_t *); } map_arg_t; static void runnable_wrapper(vo...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* libft.h :+: :+: :+: ...
C
#include <stdio.h> #include <netdb.h> #include <netinet/in.h> #include <unistd.h> #include <sys/types.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <sys/types.h> #include <time.h> #include <signal.h> void servicePlayers(int,int); int main(int argc, char *argv[]){ char message[100]; pid_t...