language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "unpipc.h" int main(int argc, char **argv) { int fd; struct stat stat; struct door_info info; if (argc != 2) err_quit("usage: doorinfo <pathname>"); fd = Open(argv[1], O_RDONLY); Fstat(fd, &stat); if (S_ISDOOR(stat.st_mode) == 0) err_quit("pathname is not a door"); Door_info(fd, &info); print...
C
#include <stdio.h> // Declare a global variable int output; int print() { printf("%d\n", output); }
C
/****************************************************************************** * Copyright (C) 2017 by Alex Fosdick - University of Colorado * * Redistribution, modification or use of this software in source or binary * forms is permitted as long as the files maintain this copyright. Users are * permitted to m...
C
// Name: Subham Subhasis Sahoo // Entry No. : 2020CSB1317 #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> // defining node structure to be used in linked lists typedef struct node { int num; struct node *next; } node; // list of linked lists typedef struct node_arr { struct n...
C
#pragma once #ifndef LBaseLibrary_H_INCLUDED #define LBaseLibrary_H_INCLUDED //----------------------------------------------------// // // // This file just serves as a basis to the rest of // // the language program. Think of it as a Library. // // It hosts the...
C
// // main.c // Triangle // // Created by Listen on 17/3/12. // Copyright © 2017年 Listen. All rights reserved. // #include <stdio.h> float remainingAngle(float a,float b){ float c = 180.0 - (a + b); return c; } int main(int argc, const char * argv[]) { float angleA = 30.0; float angleB = 60.0; ...
C
/* * Input module * * - reads the input in large chunks into a buffer * */ /* data */ static int bsize; static unsigned char buffer[MAXLINE+1 + BUFSIZE+1]; /* functions */ void inputInit() { limit = cp = &buffer[MAXLINE+1]; bsize = -1; lineno = 0; file = NULL; /* refill buffer */ fillbuf...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* image.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> void main(){ char x; while(1){ scanf("%s", x); if(x >= '0' && x <= '9'){ printf("X is a digit"); break; } } exit(0); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line_utils.c :+: :+: :+: ...
C
/* kpattgen.h By Kongfa Waroros (2020)(2563) Generating Pattern */ #ifndef __klib_pattgen_h #define __klib_pattgen_h #include <stdlib.h> #include <string.h> #define kpttgn_nullptr NULL #define kpttgn_whcMUL width * height * channel_num #define kpttgn___clearzero_whc kpttgn___clear(buffer, 0, channel_num, width, he...
C
#include <stdio.h> main() { int x, y=1, z; printf("introduza um numero para fazer a tabuada: "); scanf(" %d", &x); do{ z=x*y; printf("%d x %d = %d\n", x, y, z); y=y+1; }while (y <= 10); }
C
#include<stdio.h> int main() { int suma = 10, a = 10; float b = 15.5; char c = 'e'; char s[500]; int d; printf("La suma es: %i",suma,"\r"); printf("%i %.1f %c",a,b,c); printf("Entra el valor de la variable a: "); scanf("%i",&d); printf("Entra tu nombre: "); scanf("%s",s); printf("El valor de a es: ...
C
#include <sys/inotify.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> #include <signal.h> #include <linux/limits.h> #include <stdbool.h> extern int errno; volatile bool g_termination_flag = 0; void sig_handler (int sig); int print_event_info (const char * wdir, const struct inotify_e...
C
#ifndef STACK_H_INCLUDED #define STACK_H_INCLUDED typedef struct stack Stack; typedef union { void *pointer; int integer; double d; } Object; static int stack_errno; // 0 for success on push/pop/top, 1 for full stack on push, 2 for empty stack on pop/top, unmodified by isEmpty Stack *stack_initialize(uns...
C
#include <stdio.h> #include <math.h> int main() { double a, b, c, D, x1,x2; printf(" ax^2 + bx + c = 0 の係数 a, b, cを入力せよ----> "); scanf("%lf %lf %lf", &a, &b, &c); // (1) if (a == 0 && b == 0) { printf("係数が正しくない\n"); return 1; } // (2) if (a == 0 && b != 0) { printf("一次方程式の解が求まった。\n解は、%lf\n"...
C
/** * File Name :print.c */ /** Function: resufun * This function prints the root, pdgm,priority ,category * It takes arguments: root of char array, pdgm of char array ,offset of int type and aux_verb of * char array * Return :void */ /* HEADER FILES */ #include <string.h> #include <stdio.h> #include "./header...
C
#include <stdlib.h> #include "lists.h" /** * add_nodeint_end - add node at the end of a list * @head: pointer to the head node pointer * @n: integer for node data initialization * * Return: new node pointer if successful, otherwise NULL */ listint_t *add_nodeint_end(listint_t **head, const int n) { listint_t *n...
C
#include "pid.h" #include "stdlib.h" #include "math.h" void pid_init(PID_Typedef* PID, float kP, float kI, float kD, float out_max, float out_min) { PID->kP = kP; PID->kI = kI; PID->kD = kD; PID->out_max = out_max; PID->out_min = out_min; PID->out = 0; PID->error = 0; PID->last_error = 0; PID->last_last_...
C
#include <avr32/ap7000.h> #include "led.h" /* The current LED setup. */ int led_setup = 0; /* Set a pointer to the location of PIOC control registers. */ volatile avr32_pio_t *led_pio = &AVR32_PIOC; /* Initialize LED I/O. */ void led_init() { /* Enable the lower eight ports. */ led_pio->per |= 0xff; /* ...
C
#pragma once #include <wchar.h> struct Ticket; struct ticketContainer_wcsArrStatus; // Creates an empty tickets table file. void ticketContainer_createDatabaseTable(); // Creates a ticket from an array of 13 wide strings. struct Ticket* ticketContainer_createTicketFromDatabaseRow(wchar_t** data); // Creates an arr...
C
#include <stdlib.h> #include <math.h> #include "analisis.h" const int n10 = 0; const int n01 = 1; const int n00 = 2; const int n20 = 3;//vector de momentos const int n02 = 4; const int n11 = 5; const int n30 = 6; const int n12 = 7; const int n21 = 8; const int n03 = 9; //constructores void inicializar_analisis(anali...
C
/* Hacer un programa que por medio de un menú de opciones nos permita realizar las siguientes acciones: * Ingresar el nombre y el precio unitario de 100 artículos. El precio unitario debe ser mayor que 0 (cero). * Calcular la ganancia del 25 % para cada artículo y mostrar los datos de cada uno. * I...
C
#include "Airport_Manager.h" // CODING THIS IN A T-BELL YEEEEEEAAAAAHHHHH /* - = - = - = - = - = - = - = - = - = - = - = - typedef struct Airport{ char * name; The airport name int numDestinations; The number of destinations the airport offers flights to struct Airport ** destinations; The array of destination...
C
#include<stdio.h> int main() { int n; scanf("%d", &n); int val, avg=0, sum=0; int i=1; for(i=1; i<=n; i++){ scanf("%d", &val); sum = sum + val; } avg = sum / n; printf("%d", avg); return 0; }
C
#include "stm32f4xx.h" // Device header int main () { GPIO_InitTypeDef GPIO_InitStructure; /* RCC Configurations */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); /* TIM3 Configurations */ TIM_DeInit(TIM3); TIM_CounterMo...
C
/* Hello World program */ #include<stdio.h> unsigned int get_digit(unsigned int value, unsigned int position); unsigned int count(unsigned int i); main() { unsigned int value; unsigned int position; position = 3; value = 231456; int digit; digit = get_digit(value, position); printf("%d", ...
C
/** * Author: Ritik Jain, 18114068 * Since: May 18, 2021 * Brief: Defines The Data and Lookahead buffers for text processing units. */ #include "stdio.h" #include "string.h" const int BUFFER_SIZE = 4; char DATA_BUFFER[4]; char LOOKAHEAD_BUFFER[4]; int DATA_PTR = 0; int LOOKAHEAD_PTR = 0; fpos_t LOOKAHEAD_INITI...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "linkedlist.h" // print current node void print_node (struct node *list) { printf("| %s: %s ", list->artist, list->name); printf("\n"); } // print the entire list void print_list (struct node *list) { while (list) { print_node(...
C
// Author: Derek Gorthy // SID: 102359021 // References: Jack Dinkel, Luke Meszar, Sean Harris // // Description: This solution determines which page was least recently used and swaps it out for the next // page that is needed. /* * File: pager-predict.c * Author: Andy Sayler * http://www.andysa...
C
/* * MIT License * * Copyright (c) 2020 Sebastian Zander * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy,...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_split.c :+: :+: :+: ...
C
/*--------------------------------------------------------------------------*/ /* */ /* HW08_141044086_Vakhid_Betrakhmadov */ /* */ /* m...
C
//This file contains functions that check for valid user input #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <ctype.h> #include "struct_def.h" #include "input.h" bool ValidAction(Board board, UserMove move, int action) { if (board.the_board[move.move_row][move.move_col].visibility == 0) { ...
C
// Linked List Implementation in C #include <stdio.h> #include <malloc.h> struct Node { char data; struct Node *next; }; void Push(struct Node **topPtr, char el) { struct Node *temp = (struct Node *)malloc(sizeof(struct Node)); temp->data = el; temp->next = NULL; if (*topPtr == NULL) { ...
C
#include <stdio.h> #include <stdlib.h> // dizi elerini toplama // int main() { int i , toplam=0; int a[8]={2,3,0,-6,55,987,423,-2}; for(i=0; i<8; i++) toplam = toplam + a[i]; printf("Dizideki elemanlarin toplami: %d\n",toplam); return 0; }
C
#include <stdlib.h> #include <stdio.h> #include "dynarray.h" // DynArray impl void DynArray_deinit(DynArray *darray) { free(darray->arr); } void DynArray_add(DynArray *darray, char newValue) { darray->arr[darray->length] = newValue; darray->length += 1; // realloc mem if (darray->length == dar...
C
/* Titouan Teyssier - 11/27/16 */ #include <stdlib.h> #include "list_ptr.h" int areEqual (t_pos d1, t_pos d2) { return (d1.line == d2.line && d1.col == d2.col); } typedef struct element { struct element * next; struct element * prev; t_pos data; } t_element; t_element * gFlag; t_element * gCurrElt; int gNbElt;...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_split.c :+: :+: :+: ...
C
/*! @header JSON @abstract @discussion JSON parsing&generation. Supports string, number, dictionary & array */ #ifndef __JSON_H_ #define __JSON_H_ #include "primitive_types.h" #include "dictionary.h" #include "array.h" /*! Parses a json string and returns the root object */ Obj_t *parseJSON(cons...
C
#include <stdio.h> int main() { int n, s; int m, c = 0; printf("Enter the number \n"); scanf("%d", &n); s = n; while (n > 0) { m = n % 10; c = c + (m * m * m); n = n / 10; } if (c == s) { printf("Armstrong=%d\n", s); } else { ...
C
/* * Modulo que implemeta la logica de lectura del file system FAT12 */ #include <sodero/disquete.h> #include <sodero/syscalls.h> #include <fat.h> #ifdef DEBUG static void dump_BPB (); #endif /** * El sector numero cero del disco (Bios Parameter Block) */ BPB* sector_booteo; // el BPB /** * La tabla de FAT ( do...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* unicode.c :+: :+: :+: ...
C
/***************************************************************************** * life.c * The original sequential implementation resides here. * Do not modify this file, but you are encouraged to borrow from it ****************************************************************************/ #include "life.h" #include...
C
/* * This is sample code generated by rpcgen. * These are only templates and you can use them * as a guideline for developing your own functions. */ #include "calc.h" float * calc_1_svc(calc_in *argp, struct svc_req *rqstp) { static float result; /* * insert server code here */ printf("%d", argp->z); ...
C
#include <stdio.h> #include <sys/types.h> #include <signal.h> void deroute(int no) { switch(no) { case SIGCHLD: // mort d'un fils printf("Un fils est mort !\n"); wait(NULL); case SIGTERM: printf("Vous pouvez pas utiliser SIGTERM\n"); break; case SIGINT: printf("Vous pouvez pas utiliser ...
C
// ## Prologue // // This is the interface to a simple and general lexer function for // c-like languages. // See the source file `lex.c` for more information. #ifndef NS #define NS(id) id #endif // ## Fundamental Types // ### Context Structure // The context of our lexer includes two kinds of buffers: // A variable...
C
/* ** Author: Team The HPC Lab ** Email : admin@thehpclab.com ** Details: A program to demonstrate prefetching features on Xeon and Xeon Phi ** We have two data arrays say A and B. Both containing random numbers ** in some fashion. The values stored in array A is related to array B ** in some way. The lo...
C
void sort(int [] ser) { int n=sizeof(ser)/sizeof(ser[0]); int i; int j; for(i=0;i<n;i++) { for(j=0;j<n-i-1;j++) { if(ser[j]>ser[j+1]) { t=ser[j]; ser[j]=ser[j+1]; ser[j+1]=t; } } } }
C
//Program to display Circle pattern by accepting radius #include<stdio.h> #include<math.h> int main() { int r,d,x,y,i,j; printf("Enter Radius of circle: "); scanf("%d",&r); d=2*r+1; //+1 for including centre char a[d][d]; x=r,y=r; //Co-ordinates of Centre for(i=0;i<d;i++) for(j=0;j<d;j++) a[i][j]='.'; fl...
C
#include <stdio.h> #include "stack.h" int main (int argc, char* argv[]){ stack* stk = stk_create_stack(); contact* tmp1 = stk_create_node("Inspecteur Lestrad", "01 01 01 01 01"); stk_push (stk,tmp1); contact* tmp2 = stk_create_node("Janine", "01 03 03 03 40"); stk_push (stk,tmp2); contact* tmp3 = stk...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct node{ char word[100]; int len; struct node*next; }Node; int text(Node*head, int len); int len(Node *head); int main(int argc, char *argv[]){ if(argc!=2){ printf("Number of arguments are wrong\n"); return 0; } char array[...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <complex.h> #include <string.h> #include "readNprintPhi.h" #include "matrix.h" void printPhi(char path[100], char ps, _Complex double ***phi, int iconf, int nxi, int mt, int Lvol){ /* output FILE */ FILE *fout; /* file to save resul...
C
/* Copyright (c) 2003-2004, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. * Copyright (c) 2007-2021, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** * \file smartlist_foreach.h * \brief Macros for iterating over the elements of a smartlist_t. **/ #ifndef T...
C
#include <assert.h> #include <errno.h> #include <getopt.h> #include <math.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "c63.h" #include "tables.h" #define MARKER_START 0xff #define MARKER_DQT 0xdb #define MARKER_SOI 0xd8 #define MARKER_SOS 0xda #define MARKER_SOF0 0xc0 #d...
C
#include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <assert.h> #include <stdbool.h> #include <seq.h> #include <inttypes.h> #include <string.h> #define SIZE uint32_t /******************************/ /* */ /* -----------...
C
#include <stdio.h> #include <stdlib.h> #include "stack.h" #include "dmanager.h" struct Node* stack[MAX_STACK_ELEMS]; int position = 0; struct Node* functions[MAX_FUNCTIONS]; int p_functions = 0; void add(struct Node* node){ stack[position] = node; position++; } struct Node* pop(){ position--; return stack[posi...
C
/* ======================================== * * Copyright YOUR COMPANY, THE YEAR * All Rights Reserved * UNPUBLISHED, LICENSED SOFTWARE. * * CONFIDENTIAL AND PROPRIETARY INFORMATION * WHICH IS THE PROPERTY OF your company. * * ======================================== */ #include "InterruptRoutines.h" #include...
C
#include <cavan.h> #include <cavan/progress.h> static void progress_bar_fflush(struct progress_bar *bar) { print_ntext((char *) &bar->body, sizeof(struct progress_bar_body)); print_char('\r'); } static int update_percent(struct progress_bar *bar) { int percent = (int) (((double) bar->current) * 100 / bar->total); ...
C
#include <jansson.h> #include <string.h> // Read Cosm config file for Ip, port, and api ke CosmConfig *readCosmConfig() { int url_length; int api_key_length; char URL_CHAR[128]; char API_KEY_CHAR[128]; // JSON nodes json_t *root, *url, *json_feed, *api_key; json_error_t error; // Rea...
C
// NEO01 #include <stdio.h> #define ll long long #define gc getchar_unlocked #define INF 1000000000000000000LL int getn(){ int n = 0, c = gc(), f = 1; while(c != '-' && (c < '0' || c > '9')) c = gc(); if(c == '-') f = -1, c = gc(); while(c >= '0' && c <= '9') n = (n<<3) + (n<<1) + c - '0', c...
C
#include "dijkstra.h" /*function that ties the whole algorithm together and runs it in the correct fashion, returning the results required. Goes a little beyond the general implementation of Dijkstra's algorithm and does the results checking to find the cheapest, viable location to travel, as well as backtracking...
C
#include <stdio.h> #include <malloc.h> #define MAXQSIZE 100 //最大值 #define MAX_VERTEX_NUM 20 //最大顶点数 #define INFINITY 10000000 //最大值 #define OK 1 int visited[MAX_VERTEX_NUM];//访问标志数组 typedef struct ArcCell // 弧的定义 { int adj; // 用1或0表示是否相邻 } AdjMatrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM]; type...
C
#include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<pthread.h> pthread_mutex_t my_lock; int g_var; void * pthread1(void * arg) { printf("ENTER pthread1!\n"); pthread_mutex_lock(&my_lock); for(int i = 0; i<10; i++) { //pthread_mutex_lock(&my_lock); g_var++; printf("th1:%d\n", g_var); //pthread_m...
C
/* * p1316.c * * Created on: Mar 17, 2010 * Author: XTOg */ #include <stdio.h> int main(int argc, char* argv[]) { int MAX = 10000; int self[MAX + 1]; int i, j, sum; for (i = 1; i <= MAX; ++i) { self[i] = 1; } for (i = 1; i < MAX; ++i) { sum = i; for (j = i; j; j /= 10) { ...
C
/* Exercise 4: Using a while loop enter in 8 numbers from the keyboard */ /* Calculate the sum of all numbers entered /* Joe O'Regan */ /* 30-09-2015 */ #include<stdio.h> main() { int i=1; int sum=0; int input; printf("Adding 5 numbers entered\n"); while(i<=5) { ...
C
// // UserInput.c // WritingSkills // // Created by Aleksandra Korolczuk on 2017-09-05. // Copyright © 2017 Aleksandra Korolczuk. All rights reserved. // #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <ctype.h> #include "UserInput.h" #include "Result.h" #include "Instructions....
C
//较第一版的优化 //1、界面优化 //2、通讯录存放的数据动态开辟,节省空间 //3、排序方式灵活 //4、做了各种异常处理,增加健壮性 #include <stdio.h> #include <string.h> #include <memory.h> #include <assert.h> #include <stdlib.h> #define NAME 8 #define SEX 5 #define PHONE 12 #define ADDR 20 #define DEFAULT 5 typedef struct people { char name[NAME]; char sex[SEX]; int ag...
C
/* Linker Errors If you receive a linker error, it means that your code compiles fine, but that some function or library that is needed cannot be found. This occurs in what we call the linking stage and will prevent an executable from being generated. Many compilers do both the compiling and this linking stage. Example...
C
/** \file [board.h] \brief Contient la déclaration des fonctions, procédures, accesseurs et mutateurs, et la structure d'une board \author {Damotte Alan, Chaussende Adrien} \version 1.0 \date Avril 2013 */ #ifndef BOARD_H #define BOARD_H #include "piece.h" /* * FREE : indique que le point d...
C
#include<stdio.h> main() { char s[20]; char c; int i = 0; while ((c = getchar()) != EOF && (c != ' ') && (c != '\n')) { s[i++] = c; } s[i] = ' '; printf("%d\n", htoi(s)); } int htoi(char s[]) { int d = 0, e = 0, f; if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) { d = 2; } int j = 0; while (s[j++] != ...
C
/* date = November 29th 2020 4:14 pm */ #ifndef RAY_H #define RAY_H struct Ray{ Vec3 origin; Vec3 direction; }; Vec3 RayAt(Ray ray, f32 t){ Vec3 pos = ray.origin + (ray.direction*t); return pos; } Vec3 RayBackground(Ray ray){ Vec3 unit_direction = NormaliseVec3(ray.direction); f32 t = 0.5*(u...
C
#include <stdio.h> void put(char *s, char *str, int ret) { printf("]\n"); printf("%s, %s\n", s, str); printf("ret=%d\n", ret); printf("--------\n"); } int main(void) { int ret; char *str = NULL; printf("-----------------s\n"); ret = printf("%s", "ryojiro"); put("%s", "ryojiro", ret); ret = printf("%.s", "...
C
/Authored by Grant Slatton on 2013 September 13 //All code is released to the public domain under the terms of [http://unlicense.org] #include <string.h> #include <stdio.h> #include <stdlib.h> #include <vector> #include <utility> //returns a pair <direction, coordinate> where direction is North, Northeast, etc (clock...
C
int mapmatching(int mapstate, int gameState, int mx, int my) // To Match The Place According To Value Of mapstate { if (mx >= 735 + 50 && mx <= 772 + 50 && my >= 278 && my <= 291 && gameState == 0) { mapstate = 0; } if (mx >= 778 && mx <= 806 && my >= 210 && my <= 233 && gameState == 0) { mapstate = ...
C
#include <string.h> #include <stdio.h> #include <stdlib.h> #include <bt-memory.h> #include <bt-util.h> #ifndef SYSCONFDIR #define SYSCONFDIR "/etc" #endif #define MAP_FILES_DIRECTORY SYSCONFDIR "/bt/players.data/" typedef struct bt_oc_map_item_ru { char *name; int id; } bt_oc_map_item_ru; typedef struct bt_oc_ma...
C
/* Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 is a rotation of s1 using only one call to isSubstring. e.g. "waterbottle" is a rotation of "erbottlewat". */ # include <stdlib.h> # include <string.h> int a...
C
/* * $Id: pmemcpy.c,v 1.1 2005-09-18 22:05:43 dhmunro Exp $ * memcpy that p_mallocs its destination */ /* Copyright (c) 2005, The Regents of the University of California. * All rights reserved. * This file is part of yorick (http://yorick.sourceforge.net). * Read the accompanying LICENSE file for details. */ #i...
C
/* Módulo de definición de 'TLista'. Se definen las listas de elementos de tipo 'info_t'. Laboratorio de Programación 2. InCo-FIng-UDELAR */ #ifndef _LISTA_H #define _LISTA_H #include "utils.h" // Representación de 'TLista'. // Se debe definir en listaInfo.cpp. // struct repLista; // Declaración del tipo ...
C
#include <stdio.h> #include <stdlib.h> /* * 1: candidato 1 * 2: candidato 2 * 3: candidato 3 * 4: candidato 4 * 5: candidato 5 * * 0: voto en blanco */ int main(int argc, char const *argv[]) { unsigned int votos[6] = {0, 0, 0, 0, 0, 0}; int candidato = 0; while (candidato >= 0) { printf("In...
C
/* Partner(s) Name & E-mail: Andres Sanchez * Lab Section: B21 * Assignment: Lab # 2 Exercise # 2-3 * 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 <avr/io.h> /...
C
#include "../../include/my.h" #include "polyList.h" int main() { STATUS status; DOUBLE_LIST *pResultList, *pMulList; LP_DOUBLE_LIST pInsertNode; int n; int k; printf("Input a data which you want to calculate factorial\n"); n = 10;//scanf("%d", &n); if (n <= 0) { Print(("Input data is less than 1\n")); ...
C
/** * @fle Standard IO * @author treelite(c.xinle@gmail.com) */ #include <stdio.h> #include <string.h> static const int VGA_ADDRESS = 0xB8000; void print(char *str) { int len = strlen(str); char *p; p = (char *)VGA_ADDRESS; for (int i = 0; i < len; i++) { *p = str[i]; p++; ...
C
#include <string.h> #include "kernel.h" static int devfs_mount(struct fs *this, struct dev *dev, uint32_t addr); static int devfs_unmount(struct fs *this); static int devfs_open(struct fs *this, char *name, int mode, struct file **_fpp); static int devfs_close (struct file *_fp); static int devfs_read (struct file ...
C
#include "systick_lib.h" #include "gp_drive.h" #include "stm32f10x.h" #include "uart_drive.h" #include "str_lib.h" /* UART manager: 0-count incrementing each itme we receive msg 1-signal variable to detreermine wheather msg is ready 2-bridge vairable to confirm bridge condition or not 3-Terminator should 1:Termianator...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_dictresize.c :+: :+: :+: ...
C
#include "sort.h" /** * partition - the partition that will be done by our quicksort * @array: the array given * @low: the lowest number. * @highest: the highest number * @size: Size of the array * Return: the integer used for the partition */ int partition(int *array, int low, int highest, size_t size) ...
C
// // Created by Fabian, Moritz on 17.04.18. // #include "OSMP.h" #include <sys/mman.h> #include <fcntl.h> #include <sys/stat.h> #include <semaphore.h> #ifdef __APPLE__ #include <zconf.h> #endif #ifdef __linux__ #include <unistd.h> #endif #include <string.h> #include <errno.h> #include <math.h> #include "int_to_st...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* ft_sort_small.c :+: :+: ...
C
/* ** EPITECH PROJECT, 2020 ** B-PSU-101-BAR-1-1-minishell1-leon.ducasse ** File description: ** cd.c */ #include "mysh.h" control_t *my_cd(control_t *control, char **arg) { char *old = get_pwd(control); if (size_array(arg) > 2) { put_error(CD_MANY_ARG); return (control); } if (!arg[1...
C
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> void transverter(); int main(){ transverter(); system("pause"); return 0; } void transverter(){ char input = ' '; printf("תĸ\n"); while (1){ scanf("%c", &input); if ((input > 64 && input<91)){ printf("%cСдĸ%c\...
C
#include<stdio.h> #include <stdlib.h> #include "my_set.h" void print_set(NumbersSet *set) { int i; printf("The set is :"); for (i = 0; i < set->size; i++) { printf("%d ", set->array[i]); } } void insert_to_set(NumbersSet *set, int num) { if (!is_in_set(set, num)) { set->array[set-...
C
#include<stdio.h> #include<string.h> int main() { char s1[11], s2[11]; scanf("%s", s1); strcpy(s2, s1); printf("%s\n", s1); printf("%s\n", s2); printf("%d\n", strlen(s1)); strcat(s1, s2); printf("%s\n", s1); return 0; }
C
/* Compile: make scanf Run: ./scanf make scanf && ./scanf */ #include <stdio.h> // declaration scanf function header int main(void) { int day = 0; int month = 0; int year = 0; int matches = scanf("%d.%d.%d", &day, &month, &year); printf("%d: %d %d %d\n", matches, day, month, year); return 0; ...
C
//Prabhat kumar mahato //reg no: 11718252 //roll no:59 #include<pthread.h> #include<stdio.h> #include<semaphore.h> void *fun1(); void *fun2(); void *fa() { printf("Fa is completed\n"); } void *fb() { printf("Fb is completed\n"); } void *fc() { printf("Fc is completed\n"); } sem_t m; sem_t n;...
C
#include<stdio.h> #include <stdlib.h> #include <sys/time.h> #define MAX 1000000 double wtime() { struct timeval t; gettimeofday(&t, NULL); return (double)t.tv_sec + (double)t.tv_usec * 1E-6; } int getrand(int min, int max) { return (double)rand() / (RAND_MAX + 1.0) * (max - min) + min; } void max_heapi...
C
/* STDLIB2.C -- for BDS C v1.41 -- 10/14/80 This file contains the source for the following library functions: printf fprintf sprintf _spr scanf fscanf sscanf _scn fgets puts fputs swapin Note that all the upper-level formatted I/O functions ("printf", "fprintf", "scanf", and "fscanf") now use "_s...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include "pbPlots.h" #include "supportLib.h" /* This program does statistical analysis on data you input, either manually, through .txt file or through .bin file It can do Single variable statistics, multiple results statistics an...
C
/* * @file OSAL_Semaphore.c * @brief * @author * @version 0.1.0 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #include <semaphore.h> #include "OSAL_Memory.h" #include "OSAL_Semaphore.h" #undef JETOMX_LOG_TAG #define JETOMX_LOG_TAG "JETOMX_LOG_SEMA" #define JETO...
C
#include<stdio.h> #include<string.h> int count = 0; int n,x,y; int flag = 0; int starting = 0, xpassed = 0; int dfs(int start, int end, int adj[n][n], int visited[n]) { if(visited[start] != 0) { return 0; } if(start == x) xpassed = 1; if(start == y && xpassed == 1) { xpassed = 0; return 0; } visited[start...