language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "queue.h" #include "../list/list.h" #include <assert.h> #include <pthread.h> #include <stdlib.h> struct queue { pthread_mutex_t mtx; struct list * list; }; struct queue *queue_init(DeleteValueFunction destroy_value) { struct queue *queue = malloc(sizeof(struct queue)); queue->list = list_init(NULL, des...
C
/**** * 10550 - Combination Lock */ #include <stdio.h> #include <stdlib.h> int main() { int s, v0, v1, v2; int t; while (scanf("%d %d %d %d", &s, &v0, &v1, &v2) != EOF && (s+v0+v1+v2) != 0) { t = 120; t += (40 + s - v0) % 40; t += (40 + v1 - v0) % 40; t += (40 + v1 - v2) % 40; t *= 9; printf("%d\n", ...
C
#include <stdarg.h> void setv(int num, ...) { va_list l; void (*f)(void); (void) num; /* in this test we have only one var arg */ va_start(l, num); f = va_arg(l, void *); f(); va_end(l); } void foo(void) { /* OK, assert reached */ test_assert(1); } int main(void) { int a...
C
#include <stdio.h> int main() { double val; printf("Entrez un réel : "); scanf("%lf", &val); if (val >= -1 && val < 1) { printf("\n%lf appartient à [-1; 1[", val); } else { printf("\n%lf n'appartient pas à [-1; 1[", val); } }
C
#include <stdio.h> #include<ctype.h> int main() { int n=0,i=0,j=0,flag; char a[81],b[80]={0},x; scanf("%s\n",a); x=getchar(); while(a[i]!='\0') { if(x==a[i]){//相同则比较下一个 i++; x=getchar(); continue; } flag=1; a[i]=toupper(a[i]); for(j=0;j<n;j++) { if(b[j]==a[i]){ flag...
C
#include <stdio.h> int printPowers(int top); int power(int number,int times); int main(int argc, char const *argv[]) { int number; scanf("%d", &number); return printPowers(number); } int power(int number,int times){ if(times<1){ return 1; } return power(number,times-1)*number; } int printPowers(int ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int up (int tablero[4][4],int *score){ int i, j, k, t, invalido; invalido=0; int nuevo[4][4]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; int test[4][4]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; for(j=0;j<4;j++){ for(i=0;i<4;i++){ test[i][j]=tablero[i][j];...
C
#include "stdio.h" int main() { int x, contagem_linhas, contagem_colunas = 0; scanf("%d", &x); while(contagem_colunas < x) { contagem_linhas = 0; while(contagem_linhas < contagem_colunas + 1) { printf("# "); contagem_linhas++; } printf("\n"); contagem_colunas++; } }
C
#include <stdio.h> #include <math.h> void main(){ double x1,y1,x2,y2; scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2); printf("%.4lf\n", sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1))); }
C
#include "stack.h" #include <stdio.h> int main() { int capacity = 10; struct Stack *stack = create_stack(capacity); push(stack, 1); push(stack, 2); push(stack, 3); push(stack, 4); for (int i=0; i<4; i++) { printf("%d ", top(stack)); pop(stack); } printf("\n"); ...
C
#include <stdio.h> #include <string.h> #include <time.h> #include <stdlib.h> #include <windows.h> int x; int y=0; int pbitzahl; int zahlpb; void pbit(int temp[],int lang){ int anz; int i,j,p,f; anz=lang+zahlpb; int final[anz]; int ok=1; p=0; for(i=0;i<lang;i++){ f=1; for(j=0;j<zahlpb;j++){ if((p+1)==f)...
C
#include <stdlib.h> #include <stdio.h> #include "List.h" struct node_ { int number; Node next; }; Node newNode(int number) { Node node = malloc (sizeof(struct node_)); node->number = number; node->next = NULL; return node; } void deleteNode(Node node) { free(node); } void printNode(Node...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct node { int id; char path[1024]; struct node* next; }node; void main() { node* n1 = (node*)malloc(sizeof(node)); n1->id = 1; strcpy(n1->path, "/home/ten/t1"); n1->next = NULL; printf("id: %d\n", n1->id); printf("path: %s\n", n1->path...
C
/* Ficheiro: estruturas.h Autor: Bruno Miguel da Silva Mendes ist195544/al95544 Descricao: Ficheiro em que se definem todas as estruturas e constantes */ /*DEFENICAO DE CONSTANTES*/ #define STR_MAX 64 #define MAX_PROD 10000 #define MAX_ENC 500 #define MAX_PESO 200 /*ESTRUTURAS*/ /* Produto: int, char*, int, ...
C
/*˳Ա*/ #include "stdio.h" #include "stdlib.h" #define OK 1 #define ERROR 0 #define TRUE 1 #define FALSE 0 #define MAXSIZE 100 typedef int Status; typedef int ElemType; typedef struct { ElemType data[MAXSIZE]; int length; } SqList; /*ʼԱ*/ Status InitList (SqList *L) { L->length = 0; return OK; } ...
C
#ifndef MOVIE_H #define MOVIE_H #include <stdio.h> #include <stdlib.h> #include <string.h> /* Pelicula - Movie */ typedef struct Movies{ char *title; char *director; char **actors; int numActors; int year; int id; } Movie; /* Catalogo de peliculas - MovieCollection */ typedef struct { Mov...
C
/* -*- c -*- Thermalsensingm.nc - Module to sample LightTSR and LightPAR sensors. Copyright (C) 2011 Ross Wilkins This File is part of Cogent-House Cogent-House 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 Soft...
C
#include <stdio.h> #include "tool.h" int main() { int m,n,c,d; int first[20][20]; int second[20][20]; printf("vvedit' rayd and stovp\n"); scanf( "%i %i",&m,&n); printf("vvedit' elementi first matr\n"); for(c=0;c<m;c++){ for(d=0;d<n;d++){ scanf("%i",&firs...
C
#ifndef HEAD #define HEAD "header.h" #include HEAD #endif tablePtr JOIN(tablePtr table1, tablePtr table2) { tablePtr tableNew; int colNum1; int colNum2; int rowNum1; int rowNum2; int row1; int row2; int i; int j; tableNew = (tablePtr)malloc(sizeof(table)); //table2為NULL表示複製table1即可 if(table2 == NULL){ ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/mman.h> #include <sys/time.h> #include <sys/resource.h> static void wait_for_input(const char *msg) { char buf[32]; printf(" * %s\n", msg); printf(" -- Press ENTER to continue ...\n"); fflush(stdout)...
C
#include<stdio.h> #include "SimLList.h" #define INT_MAX 32000 struct GraphAdjListInt* initializeGraphAdjListInt(); void displayGraphAdjListInt(struct GraphAdjListInt *); void initializeSingleSource(struct GraphAdjListInt *); void displayWeightOfGraph(struct GraphAdjListInt *); struct AdjListInt{ struct SimpleLinkedLis...
C
// Threading to print array in normal and reverse order using two different threads #include<stdio.h> #include<pthread.h> #include<stdlib.h> #include<unistd.h> struct node { int *p; int n; }; void * func1(void *p) { struct node * q = (struct node *)p; for(int i=0;i<q->n;i++) { printf("Normal ...
C
#include "../include/buffer.h" #include <stdlib.h> #include <ctype.h> #include <string.h> /* variables used at main() */ char *current_line; int is_over = 0; int chars_in_line = 0; int line_count = 1; /* prints error at stderr when line_length is bigger than col_limit */ void printerror(char* file_name, int error_lin...
C
#include <project.h> UT_TEST(01_test_without_opt) { char *cmd; cmd = "-1"; reset_sandbox(); sandbox_cmd("touch aaa bbb ccc"); UT_ASSERT(strequ(ft_ls(cmd), "aaa\nbbb\nccc\n")); UT_ASSERT(strequ(ls(cmd), ft_ls(cmd))); reset_sandbox(); sandbox_cmd("touch - file"); cmd = "-1 -- - file"; UT_ASSERT(strequ(ls(c...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* columns.c :+: :+: :+: ...
C
#include "inc/StepperMotor.h" //absolute_time_t abs_time; uint64_t abs_time; StepperMotor_t *stepperMotors[MAX_MOTOR_QUANTITY]; int motorsQuantity = 0; /** * Make one step in chosen direction. * It is made by setting low state on CLK driver pin. * @TODO Describe how to set STEP on stepper motor driver (include d...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "arch/arch.h" #include "arch/section.h" #include "parsers.h" #include "utils.h" #include "simMips.h" extern char* REG_NAMES[36]; int parse_hex_value(char* hex_str, uint* hex_value, uint hex_leng, int neg_flag) { uint i; /* pr...
C
#include "volk.h" #include <stdio.h> int main() { VkResult r = volkInitialize(); if (r == VK_SUCCESS){ uint32_t version = volkGetInstanceVersion(); printf("Vulkan version %d.%d.%d initialized.\n", VK_VERSION_MAJOR(version), VK_VERSION_MINOR(version), VK_VERS...
C
/* * stm32dev_general.h * * Created on: 26-jul.-2015 * Author: Robbe */ #ifndef STM32DEV_INCLUDE_GENERAL_STM32DEV_GENERAL_H_ #define STM32DEV_INCLUDE_GENERAL_STM32DEV_GENERAL_H_ #include <stdio.h> #include <math.h> /* Macro's */ #define MAX(a,b) (((a)>(b))?(a):(b)) #define MIN(a,b) (((a)<(...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #define NUM_TESTS 6 typedef struct { char* test_name; char* input; char* fake_server_params; char* expected_result; } Test; static const Test tests[NUM_TESTS] = { { "OkResponse", "localhost 1234 abracadabra test", "1234 send_go...
C
#include "hsh.h" /** * main - run our shell!!! * @argc: the arguments count * @argv: the arguments passed in * @env: the environment variables * Return: depends, but it does the thing */ int main(int argc, char *argv[], char **env) { int history_count = 0; int status; pid_t fork_pid; char *tokenized_input[M...
C
#include <stdio.h> int main() { int a, b; int A, B, C; scanf("%d %d", &a, &b); A = b/100; B = b/10; C = b-B*10; B = B-A*10; printf("%d\n", a*C); printf("%d\n", a*B); printf("%d\n", a*A); printf("%d\n", a*b); return 0; }
C
#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include "kernel/tty.h" const char *samplesource = "size_t tty_print(const char *data)\n" "{\n" "\tsize_t len = 0;\n" "\n" "\twhile(data[len])\n" "\t\ttty_putchar(data[len++]);\n" "\n" "\treturn len;\n" "}\n" ; void kernel_main(void) { tty_init()...
C
#include<stdio.h> #include<stdlib.h> #include<time.h> #define DICT_SIZE 15 #define WORD_LEN 10 #define LINE_LEN 18 #define ROWS 15 #define COLUMNS 15 #define TRUE 1 #define FALSE 0 #define start_column 0 #define start_row 1 #define end_column 2 #define end_row 3 int get_line_size(char *line) { char *ch_iter = line; //...
C
#ifndef HOLBERTON_H #define HOLBERTON_H #include <stdio.h> #include <stdlib.h> #include <stdarg.h> /** * struct op - Struct op * * @op: The operator * @f: The function associated */ typedef struct op { char *op; void (*f)(va_list valist); } op_t; int _putchar(char c); int sum_them_all(const unsigned int n, .....
C
/* * autor: cristobal liendo * fecha: 17/1/18 * descripcion: pide "n" cantidad de numeros distinots de cero, imprime los numeros * y termina con el valor de 0. se despliega la cantidad de valores * leidos * (el ejercicio no dice cuantos numeros se van a introducir, he ahi *...
C
# include <stdio.h> typedef struct { int x, y; } Coo; # define now [now.x][now.y] int main(void){ int net[10][10] = {0}; net[5][5] = 1; Coo now = {5, 5} printf("%d\n", net[now]); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <time.h> #include <signal.h> #include <string.h> #include <sys/types.h> #include <sys/wait.h> #define BUFF_SIZE 100 static volatile int run_flag = 1; void sig_handler(int sig) { run_flag = 0; } int main(int argc, char** argv) { signal(SIGINT, si...
C
#include <stdio.h> #include <gmp.h> char *prog; typedef struct elliptic_curve_t { mpz_t A,B,p; } elliptic_curve; typedef struct point_t { mpz_t x,y; } point; void elliptic_curve_init(elliptic_curve* e) { mpz_init(e->A); mpz_init(e->B); mpz_init(e->p); } void point_init(point* p) { mpz_init(p->x); mpz_init(...
C
/* ** EPITECH PROJECT, 2018 ** setup_shape.c ** File description: ** setup shape functions */ #include "my_radar.h" sfRectangleShape *create_rectangle_entity(s_plane_t plane) { sfRectangleShape *rec = sfRectangleShape_create(); sfVector2f size = {40, 40}; sfVector2f origin = {20, 20}; sfRectangleShape_setSize(re...
C
/******************************************************************************/ /* 100k Threads */ /* Description - Handling threads for the first time */ /* Author - Dean Oron */ /* Date - 02.05.20 */ /* Reviewer - Amir SAraf */ /* ...
C
#include <stdio.h> #include <string.h> #include <malloc.h> typedef struct{ char nama[50]; float nilai; }nilaiMatKul; typedef struct elm *alamatelmt; typedef struct elm{ nilaiMatKul kontainer; alamatelmt next; }elemen; typedef struct{ elemen *first; elemen *last; }queue; void createEmpty(qu...
C
#include <stdio.h> #include <stdlib.h> #include <glib.h> #include <string.h> #define BUFFER_MAX_SIZE 1000 /* Create hashtable of word freaquency from text file. The words will be stripped off punctuations specified in delim. Parameters: table: pointer to Glib hashtable that stores word frequency ...
C
#include "stack.h" #define RED "\033[31m" #define GREEN "\033[32m" #define YELLOW "\033[33m" #define BLUE "\033[34m" #define MAGENTA "\033[35m" #define CYAN "\033[36m" #define WHITE "\033[37m" #define RESET "\033[m" static void put_colorval(int val, t_op op) { if (op == sa || op == sb || op == ss) ft_putstr_fd(BL...
C
#include <stdio.h> #define INFO1(a) \ { \ printf(a); \ } #define INFO2(a,b) \ { \ printf(a); \ printf(b); \ } #define GET_INFO_MACRO(_0,_1,NAME,...) NAME #define INFO(...) GET_INFO_MACRO(__VA_ARGS__, INFO2, INFO1) (__VA_ARGS__) int main(int argc, char **argv) {...
C
#include<stdio.h> #include<string.h> int main() { char a[20], b[20] = { 0 }; int i, j, k, count, n; count = 0; k = 0; scanf("%s", a); n = strlen(a); for (i = 0; i < n; i++) { j = i; while (a[j] == a[i]) { count++; j++; } if (count > 1) { b[k] = count + '0'; b[++k] = a[i]; } else b...
C
// An emirp (prime spelled backwards) is a prime number that results in a different prime when its decimal digits are reversed. // More details about emirps can be found at: https://en.wikipedia.org/wiki/Emirp // This question was asked to me in Zoho Programming Round 2. Hope you find it useful! #include<stdio.h> ...
C
/** * In this main function, the functionalities * of the implemntation file are used to read/ * write a file reveresed. * * @author Jamie Penzien */ #include "file_utils.h" #include <stdio.h> #include <stdlib.h> int main( int argc, char** argv ) { //Visual display that the program has begun printf("======...
C
#include "changes.h" #include "checksums.h" #include <string.h> #include <stdio.h> #define MAX_ERROR 1000000.0 bool is_valid_barcode(char *digits) { if (digits[0] < 0 || digits[0] > 9) return false; return digits[12] == ean13_checksum(digits); } float best_valid_barcode(const Change *changes, int max_changes, ...
C
#include "List.h" List* List_create() { List* this = malloc(sizeof(List)); this->first = NULL; this->last = NULL; return this; } void List_destroy(List* this) { ListNode* it = this->first; while (it) { ListNode* next = it->next; ListNode_destroy(it); it = next; } free(this); } void List_pushBack(List* ...
C
void Reverse(char* array) { char cTemp = 0; int nCharLength = 0; char *pBegin = array, *pEnd = array; while(*pEnd++ != '\0') //-- get the length of the incoming array { nCharLength++; } pEnd -= 2; //-- at this point pEnd is pointing at NULL //-- I need to back the...
C
#ifndef PIECESELECT_H #define PIECESELECT #include "functions.h" #include <sstream> inline int pieceSelect(string player){ int x, y; //mouse location bool xOut; // check close SDL_Event mouseEvent; SDL_Surface *display = SDL_SetVideoMode( 840, 840, 32, SDL_SWSURFACE ); // Surfaces used to display pieces S...
C
#include<stdio.h> #include<math.h> int even(int N) { scanf("%d",&N); for(int i=1; i<=N; i++) { if(i%2==0) { printf("%d^2 = %d\n",i,(int)pow(i,2)); } } } int main() { int N; even(N); return 0; }
C
#include <stdio.h> void main(){ int x = 50, y = 30; printf("x y ? %d\n", x == y); printf("x y ٸ ? %d\n", x != y); printf("x y ū ? %d\n", x > y); printf("x y ? %d\n", x < y); printf("x y ? %d\n", x = y); }
C
/* * trace_fatal.c: Utility functions for producing traces when a program experiences a fatal error. * * Created on: Jul 15, 2013 * Author: Yitzik Casapu, Infinidat * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You ...
C
#include<stdio.h> //baekjoon 4101 int main() { int a, b; scanf("%d%d", &a, &b); while (a != 0 && b != 0) { if (a > b) printf("Yes\n"); else printf("No\n"); scanf("%d%d", &a, &b); } return 0; }
C
#include<stdio.h> #include<stdlib.h> #include<pthread.h> #include<unistd.h> /* * This is the counter value which is to * be incremented by all the threads created * by your program */ int counter = 0; pthread_mutex_t m_lock = PTHREAD_MUTEX_INITIALIZER; void *count_incrementor(void* id){ long long thread_id=(long...
C
/* * * Name : RAMOS, JESTER DARYLHANS * Section: S15B * Submission Date: 12/3/2018 * * Implement the program for the hypotrochoid (also known as spirograph). * */ #include <stdio.h> #include "mp_math.h" int main() { /* t = theta x = x coordinates y = y coordinates a = big circle radius b = small circle...
C
/* * Network computing * Assignment 2: A HTTP thread server program * Written by Tran Quoc Hoan * programmed by milestones method (step by step) * Usage: ./HttpThread serverIP */ #include <pthread.h> #include <stdio.h> #include <string.h> /* for memset() function */ #include <time.h> #include <sys/soc...
C
/** * @file buddy.h * @brief The header file contains the buddy data type definition. */ #ifndef _BUDDY_H #define _BUDDY_H /** @brief The maximum length of JIDs */ #define MAX_JID_LENGTH (32) /** @brief The number of buddies to store */ #define MAX_BUDDIES (4) /** * @brief The length of each text message includin...
C
// #TODO: translate net-byte-order // Omar Juma // Updated last: February 17, 2015 // CSCI 367, Winter 2015 // Program 2 #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> fd_set readfds; main(...
C
int fib(); // address: 0x10704 int main(int argc, char *argv[], char *envp[]) { int local0; // m[o6 - 20] int o0; // r8 printf("Input number: "); scanf("%d", &local0); o0 = fib(); printf("fibonacci(%d) = %d\n", local0, o0); return 0; } // address: 0x106c4 int fib() { int o0; // ...
C
/* Program in c to perform insertion,deletion and display operation of circular queue */ #include<stdio.h> #define SIZE 6 struct queue { int f,r,list[SIZE]; }a; void insertion(struct queue *,int); void deletion( struct queue *); void display( struct queue *); int main() { a.f=0; a.r=0; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_info5.c :+: :+: :+: ...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
#include "highscore.h" #include <stdio.h> #include <stdlib.h> int readHighscore() { int score; FILE *datei = fopen("highscore.txt", "r"); if (datei == NULL) { return 0; } fscanf(datei, "%i", &score); fclose(datei); return score; } void saveScore(int score) { ...
C
#include "menu.h" #include "comandos.h" #include "stack.h" #include "bot.h" #include <stdio.h> #include <ctype.h> #include <string.h> /** * Imprime o menu e interpreta os comandos inseridos pelo utilizador. * @param e Estado atual. * @param topo Última jogada efetuada. * @return Estado após execução do comando ins...
C
// =========================================================== // // Lab6_Register.cpp // Description: AMBA Register // Name: <team member names here> // Date: <today's date here> // Class: CMPE-110 // Section: <Lab: section, day, and time here> // // ===========================================================...
C
#include <stdio.h> #include<stdlib.h> void merge_sort(int *a, int n); void merge(int *a, int start, int mid, int end); int main() { int length, *arr, i; printf("Enter the array length:"); scanf("%d", &length); arr = (int *)malloc(length * sizeof(int)); printf("Enter the array elements:\n"); f...
C
/* 图的数据结构-邻接矩阵 -- 接口函数 -- 从标准输入流,读入一幅图 */ //0.用户设置数据类型 typedef int Vertex typedef int WeightType typedef int DataType //1. 数据结构的实现 -- 邻接矩阵 typedef struct Gnode *PtrTOGNode; // 很聪明的通过typedef制造出一个指针类 struct GNode{ int Nv; /* 顶点数 */ int Ne; /* 边数 */ WeightType G[MaxVertaxNum][MaxVertaxNum] // 表示两点...
C
#include <stdio.h> #include <stdlib.h> /* Napraviti program koji od korisnika zahteva da unese broj elemenata u dinamicki alociranom nizu, a zatim da se taj niz popuni elementima. Nakon toga izracunati prosecnu vrednost elemenata u nizu. */ int main() { int a; float avg = 0.0; printf("unesite br...
C
/************************************************************************* > File Name: copy_block.c > Author: Wangyao > Mail: Yaowang_future@163.com > Created Time: 2014年12月10日 星期三 19时52分17秒 **********************************************************************/ #include <unistd.h> #include <sys/stat...
C
/* ** EPITECH PROJECT, 2018 ** test_eggs.c ** File description: ** test egg commands */ #include <criterion/criterion.h> #include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <fcntl.h> #include "graphical/commands.h" #include "graphical/protocols.h" #include "world.h" #include "linked_list.h" #include "...
C
#include <stdio.h> int main() { double a = 10.0; double *a_ptr = &a; char c = 0; char *c_ptr = &c; printf("%p: %c\n", c_ptr, *c_ptr); // *a_ptr *= 2; // printf("%p: %lf\n", a_ptr, *a_ptr); // printf("%p: %lf\n", &a, a); return 0; }
C
#include <stdio.h> #include <stdlib.h> int main() { float num1,num2; char c[5]; printf("Enter a no: "); scanf("%f", &num1); printf("Enter operator: "); scanf("%s", &c); if(strcmp(c,"+")==0||strcmp(c,"-")==0||strcmp(c,"/")==0||strcmp(c,"*")==0) { printf("Enter another no: ...
C
#include <stdio.h> #include <sys/types.h> #include <unistd.h> #include <sys/wait.h> /*1. Отримує та друкує інформацію про параметри свого процесу за допомогою системних викликів getpid(), getgid(), getsid() тощо. 2. Виконує розгалудження процесу за допомогою системного виклику fork(). 3. Для процесу-батька та процесу-...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct knot { char exp[200]; struct knot* left; struct knot* right; } knot; int e (int a, int b); int ou (int a, int b); int imp (int a, int b); int neg (int a); int val (char exp[]); int meio (char exp[]); int valsalva (char exp[...
C
#include <stdio.h> #include <stdlib.h> #include <fexpression.h> int main(int argc, char** argv) { /* initialization */ obj_init(); fexp_init(); /* create some objects */ object* s1 = send(String, s_string_fromwchar, L"Some String"); send(s1, s_print); wprintf(L"\n"); object* s2 = send(String, s_strin...
C
/************************************************************************* > FileName: aes.c > Author : DingJing > Mail : dingjing@live.cn > Created Time: 2020年12月23日 星期三 20时01分16秒 ************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #...
C
#include "key.h" void KEY_Init(void) { GPIO_InitTypeDef GPIO_InitStruct = {0}; /* GPIO Ports Clock Enable */ __HAL_RCC_GPIOB_CLK_ENABLE(); /*Configure GPIO pins : PB12 PB13 */ GPIO_InitStruct.Pin = GPIO_PIN_12|GPIO_PIN_13; GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING; GPIO_InitStruct.Pull = GPIO_PUL...
C
/* 3. Write a program to implement Bellman-Ford Algorithm using Dynamic Programming and verify the time complexity. */ #include <stdio.h> #include <stdlib.h> #include<limits.h> int Bellman_Ford(int G[10][10] , int V, int E, int edge[100][2]) { int i,u,v,k,distance[20],parent[10],S,flag=1; for(i=0;i<V;i++) ...
C
#ifndef FOREACH_H_ #define FOREACH_H_ // source: http://stackoverflow.com/questions/14732803/preprocessor-variadic-for-each-macro-compatible-with-msvc10 #define SEMICOLON ; #define NOTHING #define EXPAND(x) x #define FOR_EACH_NARG(...) FOR_EACH_NARG_(__VA_ARGS__, FOR_EACH_RSEQ_N()) #define FOR_EACH_NARG_(...) EXPAND(...
C
#include <math.h> #include <stdio.h> main() { int ii, jj, kk, n=5; double dx1, dx2, dx3, Y, ddata, err, error; double dx1a, dx2a, dx3a, maxerr; FILE *fp = fopen("pred.dat", "r"); double pi2 = 3.14159, pi1=0.5*3.14159; error = 0.0; maxerr = 0.0; for (ii = 0; ii < n; ii++) { dx1 =...
C
#include "main.h" /** * _get_binary - get the integer from _printf %b * then convert into binary * @args: argument corresponding to %b * Return: lenght of character printed */ int _get_binary(va_list args) { unsigned int b = va_arg(args, unsigned int); int len, i; char *str_binary = NULL; if (b == 0) retu...
C
int count_nodes(struct node *p) { if(p==NULL) { return(0); } else { return(1+count_nodes(p->left)+count_nodes(p->right)); } }
C
#pragma once ////////////////////////////////////////////////////////////////////////// #define RECV_BUF_MAX_COUNT (64*1024) #define RECV_BUF_NODE_COUNT (200) ////////////////////////////////////////////////////////////////////////// typedef struct _b_recv_buf_node_type { int DataLen; unsigned char Buf[RECV_BUF_M...
C
#ifndef UTIL_H #define UTIL_H #include "../project.h" // need to put all of function definitions in here and a comment saying what they do. Easier for us as well. int getabsname(MINODE *mip, char name[]); int get_block(int fd, int blk, char buf[ ]); int put_block(int fd, int blk, char buf[ ]); int tst_bit(char *buf,...
C
#include <stdio.h> //adding comment which must be removed in preprocessing step int main() { int a=10; int b=20; printf("value of a is %d and of b is %d \n", a , b); return 0; }
C
//Author: Thomas Noelcke //CS 372 Spring 2017 // //Description: This is the client side of an instant messanger chat client. //Client takes two arguments the host name for the computer the server is running on //and the port number for the sever. This program will then ask you to enter in your handle //a single work ...
C
#include <stdio.h> #define THREE 3 #define TWO 2 int main() { int l, b, c; c = 0; scanf("%d %d", &l, &b); while (l <= b) { l *= THREE; b *= TWO; c++; } printf("%d\n", c); }
C
/******************* celsious to farenheet ************************/ #include <stdio.h> main() { float celsious,fahr,step=20,upper=200; // celsious to farenheet celsious = 0; printf("\ftemperature convertion \n"); printf("celsious\t\tfarenheet\n"); while(celsious<=upper) { f128ahr=((9*celsious)/5)+32; ...
C
#include <stdio.h> #define MAX_TREES 100 typedef struct BinNode *Position; typedef struct BinNode *BinTree; typedef struct Colletcion *BinQueue; struct BinNode { int Element; Position LeftChild; Position NextSibiling; }; struct Colletcion { int CurrentSize; BinTree TheTrees[MAX_TREES]; }; BinTr...
C
/* Merge sort in C */ #include<stdio.h> #include<stdlib.h> #include<time.h> //Função para mesclar matrizes L e R em A. //lefCount = número de elementos em L //rightCount = número de elementos em R. void Merge(int *A,int *L,int leftCount,int *R,int rightCount) { int i,j,k; //i - para marcar o índice de auba...
C
#include<stdio.h> int main() { int i=34; printf("int=%d i=%d 34=%d \n",sizeof(int),sizeof(i),sizeof(34)); char ch='a'; printf("char=%d ch=%d 'a'=%d \n",sizeof(char),sizeof(ch),sizeof('a')); //here we get 1 1 4 because 'a' store in ch as ASCII and the ASCII of 'a' is 97 and it is integer; float f=34.7...
C
/* Student Name:Bishal Rai Subject:Programming Fundamental Roll No:13 Lab Sheet No:20 Program:To enter length and breadth and display area of rectangle using function Date:18/01/2017 */ #include<stdio.h> void area(); int main() { area(); return 0; } void area() { int l,b,a; printf("Enter the length:"); scanf("%d",...
C
#include<stdio.h> int main() { float n,a,d,e,f,g,h,i,j,k,l,m,p; int b,c,o,q,r,s,t,u,v,w,x,y,z,zz,bb,cc,mm,pp,qq,rr,ll,dd; scanf("%f",&n); printf("NOTAS:\n"); if(n>100){ a=n/100; b=n/100; c=b*100; d=(n-c); printf("%d nota(s) de R$ 100.00\n",b); } e...
C
#ifndef _LIB_H #define _LIB_H // Add commands into this file. Please leave a short description. // `cat` function. Copies stdin to stdout. int cat(int argc, char *argv[]); // `chmod` function. Changes files rights. int chmod_lb(int argc, char *argv[]); // chown function. Change the owner and the group owner of a fi...
C
/* ** victory.c for sudoku in /home/brout_m/RENDU/CPE/sudoki-bi ** ** Made by marc brout ** Login <brout_m@epitech.net> ** ** Started on Sun Feb 28 21:29:36 2016 marc brout ** Last update Sun Feb 28 21:54:13 2016 marc brout */ #include "game.h" void print_victory(t_bunny_pixelarray *back, t_bunny_pixel...
C
#include <stdio.h> #include <string.h> int main(int argc, char const *argv[]) { char name[] = "你好"; printf("%s\n, arr size: %ld, str len: %d\n", name, sizeof(name), strlen(name)); return 0; }
C
#pragma once #pragma once #include "stdio.h" #include "stdlib.h" #define HASHSIZE 10 // ɢб #define NULLKEY -32768 typedef struct { int *elem; // Ԫش洢ַ̬ int count; // ǰԪظ }HashTable; int m = 0; int Init(HashTable *H) { int i; m = HASHSIZE; H->elem = (int *)malloc(m * sizeof(int)); //ڴ H->count = m;...