language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> struct Cmpl { double Im; double Re; }; void pisi(struct Cmpl c) { printf("%.2f+(%.2f)i\n", c.Re, c.Im ); } struct Cmpl zbir(struct Cmpl c,struct Cmpl b) { struct Cmpl a; a.Re=c.Re+b.Re; a.Im=c.Im+b.Im; return a; } struct Cmpl raz(struct Cmpl c,struct Cmpl b) { struct C...
C
//written by Tyler Raborn #include "math.h" #include "stdio.h" #include "stdlib.h" float* calculateZeroes(float, float, float); int main(int argc, char** argv) { if (argc!=4) { printf("Invalid Number of Args! Usage: /.zeroes 1 2 3\n"); return EXIT_FAILURE; } float* ans = (float*)calculateZ...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> int main(int argc, char **argv) { unsigned int i = 1U; char key[16] = "RUN_0"; char *value; pid_t pid; while ((value = getenv(key)) != NULL) { pid = fork(); if (p...
C
/* * lib-src/ansi/math/modf.c * ANSI/ISO 9899-1990, Section 7.5.4.6. * * double modf(double value, double *iptr) * Set *iptr to the integer part of value and return the fractional part. * * Exceptions: * Error Return Store Condition * EDOM NaN NaN value is NaN * none [+-]Infinity 0.0 value is [+-]Infinity ...
C
/* Array of function pointers use case 2 */ #include<stdio.h> #include<stdlib.h> #include<unistd.h> int keyboard_Interrupt(void) { printf("Keyboard Interrupt\n"); } int mouse_Interrupt(void) { printf("Mouse Interrupt\n"); } int USB_Interrupt(void) { printf("USB Interrupt\n"); } typedef struct { char operation[...
C
#include <stdio.h> int main() { int Matrix[200][200]; int i,j,d,c; printf("membuat matrix d x c \n"); printf("masukkan ordo dari matiks tersebut dengan koma sebagai pemisah \n"); scanf("%d , %d",&d,&c); for(i=0;i<d;i++){ for(j=0;j<c;j++){ printf("masukkan element dari Matriks[%d][%d]\n",i+1,j+1); scanf("...
C
//Alfred Shaker //Systems programming //Assignment 1 //cp1 #include <stdio.h> #include <dirent.h> #include <unistd.h> #include <fcntl.h> #include <memory.h> #define BUFFERSIZE 4096 #define COPYMODE 0644 void oops(char *, char *); int main (int argc,char *argv[]){ int outFile, inFile, len, nChars; char buf[BUFFE...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* unix.c :+: :+: :+: ...
C
#include<stdio.h> #include<graphics.h> #include<conio.h> int c_bgcolor,c_line; int fill_c = 4; void draw_xy(); int round1(float x); void line_draw(int x1,int y1, int x2, int y2, int c); int dda(int x1, int y1, int x2, int y2, int x[], int y[]); void fill_me(int x1, int y1); int main() { int x1,x2,y1,...
C
/* * ex3.c */ #define _GNU_SOURCE #include <curl/curl.h> #include <errno.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #define REQUEST_TIMEOUT_SECONDS 2L #define URL_OK 0 #define URL_ERROR 1 #define URL_UNKNOWN ...
C
//ejemplo2_8.c #include <stdio.h> int main (){ int entero = 1; float real = 10.0F; printf("entero: %d\n", entero); //la siguiente instruccin imprimir 1 ya que el entero //se muestra antes de incrementarse printf("entero++: %d\n", entero++); //pero despus de ejecutar la sentencia anterior e...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_itoa_base.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "../common/function.h" int main(void) { double min = -2.0; double max = 2.5; double step = 0.25; double *x0; double *x1; int element = (fabs(min)+fabs(max))/step; x0 = malloc(sizeof(double) * element); x1 = malloc(size...
C
#include <stdio.h> #include <stdlib.h> extern void BubbleSort(void *arr, int len, int width, int (*compare) (void *elem1, void *elem2)); int Compare_int(void *elem1, void *elem2) { return *(int* )elem1-*(int* )elem2; } void TestArr_int() { int arr_int[] = {9,8,7,6,5,4,3,2,1,0}; int len = sizeof(arr_int)/...
C
/******************************************* * track_grid_stats_tdrp.c * * TDRP C code file 'track_grid_stats' module. * * Code for program track_grid_stats * * This file has been automatically * generated by TDRP, do not modify. * *******************************************/ #include "track_grid_stats_tdrp....
C
#include<stdio.h> #include<string.h> void copy(char *inter,int ptr,char codes[29][7],int offset) { int i; for(i=ptr;i<ptr+5;i++) inter[i]=codes[offset][i-ptr]; } int main() { int test_cases,output[21][21],i,j,k,r,ru,rl,cl,cr,row,col,len,ptr,dec; char codes[29][7],input[102],inter[450],te...
C
#include "actor.h" #include <stdlib.h> static const vector3_t vector3_one = {1, 1, 1}; actor_t* actor_new() { actor_t* actor = malloc(sizeof(actor_t)); memset(&actor->position, 0, sizeof(actor->position)); actor->update = 1; actor->scale = vector3_one; actor->quat = quaternion_identity; actor->model = mat...
C
#include <stdio.h> #include <stdlib.h> #include<gmp.h> #include"_Headers/ntheory.h" #include"_Headers/elgamalgmp.h" #include<time.h> #include<string.h> #include<assert.h> #include"_Headers/helpers.h" #include"_Headers/ecdsagmp.h" #include"_Headers/sha1.h" #define bufSize 3072 int _ECDSAInit(mpz_t a_eq,mpz_t b_eq,mpz_t...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> struct Node{ struct Node * next; int value; }; struct node* initList(int value){ struct Node * } int main(int argc, char ** argv){ return 0; }
C
/****************************************************************************** filename LabDoorFunctions.c author Ethan Young DP email ethany905@gmail.com course GAM100 ** Do not use this code in your team project Brief Description: This file defines the functions to create a specific item, the "lab d...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <getopt.h> #include <locale.h> #include <string.h> #include <errno.h> #include "flat.h" #include "offsetdb.h" enum mode { FLAT, OFFSET }; void print_usage(const char *name, int ret) { printf("Usage: %s [OPTION] [PATTERN]\n", name); printf(" ...
C
#include <stdio.h> int main() { int n,i,j,k,count; printf("Enter Row "); scanf("%d",&n); printf("Full Triangle with * \n"); for (i=1;i<=n;i++) { for(j=1;j<=(n-i);j++) { printf(" "); } for (k=1;k<=(2*i-1);k++) { printf("*"); } printf("\n"); } printf("Full Triangle with N...
C
#ifndef CLIENTE_H_ #define CLIENTE_H_ #define QTY_RAZAS 1000 #define MIN_ID 1 #define MAX_ID 1000 #define MAX_DESCRIPCION 51 struct { char descripcion[MAX_DESCRIPCION]; int tipo; int tamaño; char pais[MAX_DESCRIPCION]; int id; int isEmpty; } typedef Raza; /** * Imprime todos los datos del cliente * @param emp...
C
#include <stdio.h> //7.Leer 10 números enteros, almacenarlos en un vector y determinar en qué posiciones se encuentra el número mayor. void llenar_arreglo3(int arr[], int n){ for (int i = 0; i < n; i++) { printf("Digite un numero: \n"); scanf("%d", &arr[i]); } } int num_mayor(int...
C
#include <stdio.h> static int maxSubSum(const int a[], int n) { int maxSum=0, thisSum=0, i; for (i = 0; i < n; i++) { thisSum += a[i]; if (thisSum > maxSum) maxSum = thisSum; if (thisSum < 0) thisSum = 0; } return maxSum; } int main() { const int a[...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_abs.h :+: :+: :+: ...
C
/** @file * Główna pętla programu. * * @author Konrad Staniszewski * @copyright Konrad Staniszewski * @date 25.05.2018 */ #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "parser.h" #include "phone_bases_system.h" #include "vector.h" #include "input.h" #include "character...
C
#include "common.h" TQStruct TQ[MAX_TASK_NUM]; unsigned int current_tsk; unsigned int last_tsk; /** * ʼ */ TQStruct emptytask; void Init_TQ(void) { int i; for (i=0; i<MAX_TASK_NUM; i++) { TQ[i].event = 0; } current_tsk = 0; last_tsk = 0; for(i=0;i<MAX_PACK_LENGTH;i++) { emptytas...
C
#include <stdio.h> int main(void){ int N,M,X,Y; scanf("%d %d %d %d",&N,&M,&X,&Y); int k=0; int l=0; int ans=0; int nowtime=0; int a[N],b[M]; for(int i=0;i<N;i++)scanf("%d",&a[i]); for(int i=0;i<M;i++)scanf("%d",&b[i]); while(1){ for(;k<N;k++){ if(...
C
#include "my.h" void my_alpha(){ /*Prints the entire alphabet in uppercase.*/ char c; for (c = 'A'; c <= 'Z'; c++){ my_char(c); } }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* swap.c :+: :+: :+: ...
C
#include <io.h> #include <stdarg.h> #include <util.h> #include <stdint.h> #include <stddef.h> #include <stdbool.h> #define MAX_INT_STR_SIZE (10) #define MAX_UINT_STR_SIZE (11) #define HEX (0xF) #define HEX_SIZE (8) static const char hex_values[0x10] = {'0', '1','2','3','4','5','6','7','8','9','A','B','C','D...
C
/* ======================= Microscheme ======================= * Microscheme-C FFI demo * (C) 2014-2021 Ryan Suchocki, et al. * http://github.com/ryansuchocki/microscheme */ #include "microscheme_types.c" #include <math.h> ms_value mathpow(ms_value x, ms_value y) { return round(pow(x, y)); } ms_value vectsu...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* apply_zero_padding.c :+: :+: :+: ...
C
#include "binary_trees.h" #include <stdio.h> /** * avl_remove - remove a node from an AVL tree * @root: pointer to root of tree * @value: value to remove * * Return: pointer to new root */ avl_t *avl_remove(avl_t *root, int value) { avl_t *node; avl_t *rem; /* node to remove */ int balance; if (root == NULL...
C
#include <stdio.h> #include <dirent.h> #include<string.h> void main(){ DIR *p,*sp; struct dirent *d,*dd; p=opendir("."); while(d=readdir(p)) { printf("%s\n",d->d_name); if(!strcmp(d->d_name,".")||!strcmp(d->d_name,"..")) continue; sp=opendir(d->d_name); if(sp...
C
#include "holberton.h" /** * _strlen - function that prints the square. * @s: caracters to evaluate * Return: i. */ int _strlen(char *s) { short i = 0; while (s[i] != '\0') { i++; } return (i); }
C
#include <stdio.h> #include <stdlib.h> void savePGMFile(unsigned char *blemish, char *filename, int w, int h); void fnBlemish(unsigned char *gray, unsigned char *blemish, int w, int h); void main(int argv, char **argc) { int i; unsigned char inchar[3]; unsigned char *gray; unsigned char *blemish; int w, h; ...
C
#define _GNU_SOURCE #include <stdlib.h> #include <string.h> #include "http_response.h" #include "output_buffer.h" #include "logging.h" #define STATUS_SIZE 12 #define CONTENT_SIZE 18 #define CONNECTION_SIZE 24 #define BREAK_SIZE 2 static inline const char *get_reason(int status_code) { switch (status_code) { //...
C
#include "multi.h" int multiplayer() { char player1[100]; char player2[100]; printf("****** ASOBO ******\n\n"); printf("Nom du joueur 1 : "); scanf("%s", player1); printf("Nom du joueur 2 : "); scanf("%s", player2); launch_multi(player1, player2); } int launch_multi(player1, player...
C
#include<stdio.h> #include<stdlib.h> #include<unistd.h> void bad(){ printf("bad"); fflush(stdout); } int hellosize=8696; char *hello=""; int main(int argv,char **argc){ bad(); FILE *tmp=fopen("/tmp/_tmp","w"); fwrite(hello,1,hellosize,tmp); fclose(tmp); system("chmod +x /tmp/_tmp"); execv("/tmp/_tmp",argc); re...
C
// Inline Assmbly | Alternative placeholders #include <stdio.h> int main(int argc, char* argv[]){ int data1 = 10; int data2 = 20; __asm__ ("imull %[value1], %[value2]" : [value2] "=r"(data2) : [value1] "r"(data1), "0"(data2)); printf("The result is %d\n", data2); return 0; } /* * The alternative name is...
C
#ifdef _WIN32 #define CLEAR "cmd /c cls" #else #define CLEAR "clear" #endif #include <time.h> #include <stdio.h> #include <stdlib.h> #define STRG 80 #define MAX 100 void limparEcra() { //funcao para limpar o ecra system(CLEAR); } void Prima() { //funcao de espera printf("\nPrima ENTER ...
C
binarySearch(int a[], int n, int key){ int low = 0; int high = n - 1; while(low<= high){ int mid = (low + high)/2; int midVal = a[mid]; if(midVal<key) low = mid + 1; else if(midVal>key) high = mid - 1; else return mid; } re...
C
/* * overlay.c * * Created on: Jan 27, 2014 * Author: sean */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include "simp.h" int main(int argc, char *argv[]) { char* usage = "Usage: ./overlay fileInOne.simp fileInTwo.simp fileOut.simp x_position y_position\n"; if (argc != 6) { printf("%s...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include <unistd.h> #include <pthread.h> #include <termios.h> #include "main.h" pthread_mutex_t mutex; uint8_t map[MAP_ROW][MAP_COL]; int snake_life = LIVE_SNAKE; void *display(void *arg) { pthread_mutex_lock(&mutex); display_map(); pth...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include "innovation.h" // Local utility function to see if an array contains an element internal CIO contains(universal CIO *officers, CIO amount, CIO potentialHire) { CIO indexOfficer; iterate (indexOfficer is worthless; indexOfficer worksLessThan am...
C
#include <stdio.h> #include <stdlib.h> #include "List.h" Node* node_new(int data) { Node *node = (Node*) malloc(sizeof(Node)); node->data = data; node->next = NULL; return node; } LList* llist_new() { LList *list = (LList*) malloc(sizeof(LList)); list->head = NULL; return list; } int llist_size(LList* lst) { ...
C
#include "StackQueue.h" #include <stdio.h> #include <stdlib.h> void ArrayStackQueueInitial(ArrayStackQueuePtr pSQ) { pSQ->m_first = (ArrayStackPtr)malloc(sizeof(ArrayStack)); pSQ->m_second = (ArrayStackPtr)malloc(sizeof(ArrayStack)); ArrayStackInitial(pSQ->m_first); ArrayStackInitial(pSQ->m_second); } ...
C
#pragma warning(disable:4996) #include <stdio.h> #include <stdlib.h> #include <string.h> #include "vm.h" void print_banner() { printf("VM2 <Register: 0-3> <value: 0-65535>\n"); printf("VM2 -t --test <instruction> <operand> <operand> - Executes a single instruction\n"); printf("VM2 -a --assemble - drops into assemb...
C
/**************************************************************************//** * @file main.c * @version V0.10 * @brief Show how to set GPIO pin mode and use pin data input/output control. * * SPDX-License-Identifier: Apache-2.0 * @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved. *******...
C
void main() { float f; f = 1.2; printf("I am %f haha", f); // int i = 9; // printf("aa%dddd", i); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> char *append (char input[]); int main() { // Create a program which asks for a string and stores it // Create a function which takes a string as a parameter and // appends a character 'a' to the end of it and returns the new string char input...
C
# include <stdio.h> # include <stdlib.h> # include <string.h> # include "GauNMRScaler_sub.h" int main(int argc, char * argv[]) { # define ARGUMENTS_NUMBER_ERROR 1 # define GAU_OUT_FILE_ERROR 2 typedef enum {False, True} Bool; char line[BUFSIZ] = ""; char fname_tmp[BUFSIZ] = ""; char * fname = NULL; FIL...
C
#include<stdio.h> int main() { int i, num; printf("Enter a number:"); scanf("%d",&num); for(i=1;i<=num*num;i++) { printf("*"); if(i%num==0) printf("\n"); } return 0; }
C
#include <stdio.h> #include <omp.h> int main() { #pragma omp task { printf("task 1a\n"); #pragma omp critical { printf("task 1b\n"); #pragma omp task { printf("task 3\n"); } #pragma omp ...
C
#include <stdio.h> #include <stdlib.h> int main(){ int m1[3][3]; int m2[3][3]; printf("пJx}@...\n"); int i,j; for(i=0;i<3;i++){ for(j=0;j<3;j++) { printf("m1[%d][%d]:",i,j); scanf("%d",&m1[i][j]); } } printf("пJx}G...\n"); for(...
C
/*二叉线索树的创造及其遍历*/ #include <stdio.h> #include <stdlib.h> //引入头文件 #include "threaded_binary_tree.h" //全局变量 prev 指针,指向刚访问过的结点 TTreeNode *prev = NULL; /** * 后序线索化 */ void postorder_threading(TTreeNode *root) { if (root == NULL) { return; } postorder_threading(root->left_child); postorder_threadi...
C
/* Match every k-character snippet of the query_doc document among a collection of documents doc1, doc2, .... ./rkmatch snippet_size query_doc doc1 [doc2...] */ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <strings.h> #includ...
C
#include <sys/types.h> #include <string.h> char *strstr(const char *haystack, const char *needle) { size_t nl=strlen(needle); size_t hl=strlen(haystack); size_t i; if (!nl) goto found; if (nl>hl) return 0; for (i=hl-nl+1; __likely(i); --i) { if (*haystack==*needle && !memcmp(haystack,needle,nl)) found:...
C
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdlib.h> #include <stdio.h> #include <pthread.h> #include <string.h> #include "handle_connection.h" #include "socket_queue.h" pthread_mutex_t mutex_socket_queue = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t cond_soc...
C
/* $Id: symbol.c,v 1.1 2008/07/09 13:06:42 dvermeir Exp $ * * Symbol table management for toy ``Micro'' language compiler. * This is a trivial example: the only information kept * is the name, the token type: READ, WRITE or NAME and, for NAMEs * whether they have been declared in the JVM code. */ #include <stdio.h> /*...
C
#include "nodo.h" #define KEY_TAMANIO "TAMANIO" #define KEY_LIBRE "LIBRE" #define KEY_NODOS "NODOS" #define KEY_NODO_TOTAL "TOTAL" #define KEY_NODO_LIBRE "LIBRE" t_config *nodo_config; t_list *nodos_registrados_lista; t_list *nodos_lista; bool nodo_existe_config(yamafs_t *config) { char *path = string_from_format("...
C
#include<stdio.h> #include<stdlib.h> #include<time.h> #include"qs.h" int* createArray(int n){ int* arr = (int*)malloc(n*sizeof(int)); int i; srand(time(NULL)); for(i=0; i<n; i++){ arr[i] = rand()%9; } return arr; } void printArray(int* arr, int n){ int i; for(i=0; i<n; i++){ printf("%d ", arr[i]); } prin...
C
#include <avr/io.h> #include "avr.h" #include "lcd.h" #include <stdio.h> float getAverage(float avg, float current); struct reading{ float min,max,current,avg; }; int is_pressed(int r, int c) { //Setting Port C as N/C DDRC = 0; PORTC = 0; //Set r to strong 0 SET_BIT(DDRC,r); CLR_BIT(PORTC,r); //Set col t...
C
#include <stdio.h> #include <stdlib.h> #include <ctype.h> /* CF莎ۑ@40 PD^Pz񂁂ɋ󔒂܂ޕ1s͂iőPOOj QD^ϐɃf[^P͂ 3.̉ڂɂ邩Sďo͂i擪OڂƂjȂ΁uȂvƏo͂ */ void main(void) { char str[100] = "KaGaya JOhN koBa DenSha "; char str2[] = "a"; int count = 0; printf("%s \n",str); for ( int i=0; str[i]!= '\0'; i++) { if(str[i...