language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
// Graph ADT interface // Taken from COMP2521 wk05 lecture (ashesh) #ifndef GRAPH_H #define GRAPH_H #include <stdbool.h> #include "list.h" typedef struct GraphRep *Graph; // vertices are strings typedef char* Vertex; // edges are pairs of vertices (end-points) typedef struct Edge { Vertex start; Vertex end; }...
C
#ifndef __NODE_H__ #define __NODE_H__ struct ListNode { int val; struct ListNode *next; }; struct ListNode* makeList(int *a, int n) { struct ListNode *tmp, *head = NULL, *cur; if(a == NULL || n == 0) return NULL; for(int i = 0; i < n; i++) { tmp = (struct ListNode *)calloc(1, sizeof(struct ListNode)); ...
C
/* * Copyright (c) 2011, C-Talks and/or its owners. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software ...
C
/* * IncFile2.h * * Created: 01.12.2018 20:06:04 * Author: MarcinS */ #ifndef INCFILE2_H_ #define INCFILE2_H_ /*SUM OF NIDDLE COLORS CANNOT BE GREATER THAN 255 */ /*Second niddle is the largest while Houre niddle is the smallest */ #include <avr/io.h> #include "CDiagNeopixel.h" void createLines(); /*NIDDLES*...
C
#include "stm32spi1.h" #include "bikeRC522.h" #include "delay.h" /* *************************************************************** * : bikeRC522_delay_ns * : ʱ * : NULL * : NULL * : NULL * : *************************************************************** */ void bikeRC522_delay_ns(u32 ns) { u32 i; for ...
C
#include <math.h> #include <stdio.h> typedef struct point { float x, y, z; } point; float magnitude(point p1) { float mag = sqrt(p1.x * p1.x + p1.y * p1.y + p1.z * p1.z); return mag; } point resultantVector (point p1, point p2) { point resultant = {p2.x - p1.x, p2.y - p1.y, p2.z - p1.z}; return res...
C
#include <stdio.h> #include <math.h> int main() { /** * Escreva a sua soluo aqui * Code your solution here * Escriba su solucin aqu */ int tempo, velo; double x , y; y = 12; scanf ("%d", &tempo); scanf ("%d", &velo); x = (tempo * velo) / y; printf ("%.3lf\n", x); return 0; }
C
#include "buddy.h" // Stupid & simple tests int main(int argc, char* argv[]) { size_t size = 0x100 + sizeof(buddy_alloc_t); uintptr_t address = (uintptr_t) malloc(size); buddy_alloc_t* buddy = buddy_init(address, size); printf("[T] Initialization finished...\n"); buddy_status(buddy); printf("\n"); printf("[T...
C
/* Program for polynomial addition */ /* Date: 09 Mar 2003 */ /* Author: Srinivas Nayak */ /* Compile using Turbo C++ */ /* This code is distributed under the GPL License. */ /* For more info check: */ /* http://www.gnu.org/copyleft/gpl.html */ #include<stdio.h> #include<conio.h> main() { int a[20],b[...
C
#ifndef __BOUNDINGBOX__H__ #define __BOUNDINGBOX__H__ #include "Triangulo.h" #include "Plane.h" #include "Esfera.h" typedef struct { float3 minimum; float3 maximum; } BoundingBox; void BoundingBoxSetMinMax(BoundingBox* bb, float3 min, float3 max); /* Setea el minimo y el maximo del bounding box los ...
C
#include<stdio.h> int stack[100],top=-1,n,flag; main() { printf("The max size of stack: "); scanf("%d",&n); while(flag!=1) { int ch; printf("1. Push\n"); printf("2. Pop\n"); printf("3. Peek\n"); printf("4. isEmpty\n"); printf("5. isFull\n");...
C
/* * display.c - Error handling and menu display functions. */ #include "display.h" void exit_conn(PGconn *conn) { PQfinish(conn); exit(EXIT_FAILURE); } void exit_success(PGconn *conn) { time_t t; struct tm tm; t = time(NULL); tm = *localtime(&t); printf("\n=========== %d-%02d-%02d %02d:%02d:%02d ========...
C
//------------------------------------------------------------------------ // Common functions for file system module.All file systems,include FAT32, // NTFS or others,will use several or all functions in this module. // // Author : Garry.Xin // Initial date : Jul 05,2013 // Last updated ...
C
/*! * @file main.c * @brief IRGesture2 Click example * * # Description * This example demonstrates the use of IR Gesture 2 click board by reading and displaying * the raw ADC values of entire 60-pixel IR photodiode array. * * The demo application is composed of two sections : * * ## Application Init * Initia...
C
#include<stdio.h> #define N 10 int main(void) { double ident [N] [N]; int row, col; for (row = 0; row < N; row++) for (col = 0; col < N; col++) if (row == col) ident [row] [col] = 1.0; else ident [row] [col] = 0.0; printf("%f", ident [N]...
C
#include <stdio.h> #include <stdlib.h> char buf[128]; struct student { int id; char name[32]; int score; }; typedef struct student datatype; struct rb_node { datatype data; struct rb_node *left, *right; int black; }; struct rb_node* get_rbtree(){ struct rb_node *t; char c; if(fgets(buf,sizeof(buf),stdin)==NULL || ...
C
#include<stdio.h> #include<stdlib.h> typedef struct stackArray { int top; int capacity; int *array; }stackArray; stackArray * createStack() { stackArray *stack=(stackArray*)malloc(sizeof(stackArray)); if(stack==NULL) { printf("No memory allocated"); exit(0); } stack->capacity=10; stack->top=...
C
// gcc -g -O2 -o parameter_ref parameter_ref.c volatile int vv; /* Don't inline, but do allow clone to create specialized versions. */ static __attribute__((noinline)) int foo (int x, int y, int z) { int a = x * 2; int b = y * 2; int c = z * 2; vv++; return x + z; } int main (int x, char **argv) { retur...
C
#include "libblinkstick.h" bool print_debug = false; void debug(const char* fmt, ...) { if (print_debug) { char buffer[256]; va_list ap; va_start(ap, fmt); vsprintf(buffer, fmt, ap); va_end(ap); puts(buffer); } } void blinkstick_debug() { print_debug = true; debug("STARTING LIBBLINKS...
C
/*---------------------------------------------------------------------------------------------- * Module: Timer * File Name: timer. * AUTHOR: Bassnat Yasser * Data Created: 5 / 9 / 2021 * Description: Header file for the Timer AVR driver --------------------------------------------------------------------------...
C
#include "mode.h" #include "debug.h" #include <string.h> #include <stdlib.h> char* get_tm_interactive_input_mode_mask() { return getenv("TM_INTERACTIVE_INPUT"); } bool mode_contains(char *target) { // Because strsep modifies the string in place, we need to make a copy. char *mode_mask = get_tm_inter...
C
#include <stdio.h> #include <stdlib.h> #define MIN(x,y) (((x) > (y)) ? (y) : (x)) typedef struct __Point { int x,y; } Point; int main() { int numberOfSpeakers; int index; int sizeOfSpeakers[100000] = { 0 }; int volumeOfSpeakers = 1000000; Point pointOfSpeakers[100000]; // Input 처리 부분 ...
C
#include <stdio.h> int main (int argc, char *argv[]){ int i; double n; double soma = 0; scanf("%lf", &n); for (i = 1; i <= n; i++){ soma += i / (n - i + 1); } printf("%.4lf\n", soma); return 0; }
C
#include <stdio.h> #include <stdlib.h> void intercala(int *vetor, int l, int meio, int r) { int *aux = malloc(sizeof(int) * (r - l + 1)); int a = l, b = meio + 1, c = 0; while (a <= meio && b <= r) { if (*(vetor + a) <= *(vetor + b)) { *(aux + c++) = *(vetor + a++); } else { *...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <unistd.h> #include <sys/stat.h> #ifdef WITH_NEAT #include "server_neat.h" #else #include "server_sockets.h" #endif void usage(char *argv[]) { printf("Usage:\n"); printf("\t%s [-p 5001] <file 1> [file 2 ... file N]\n", arg...
C
/* i2c_test.c D.J.Whale 18/07/2014 * * A simple I2C port exerciser. */ /***** INCLUDES *****/ #include <stdio.h> #include <stdlib.h> #include <time.h> #include "gpio.h" #include "i2c.h" /***** CONSTANTS *****/ /* GPIO numbers on Raspberry Pi REV2 */ #define SDA 2 #define SCL 3 /* ms */ #define TSETTLE (1UL)...
C
/*******************************************/ /* BUSQUEDA.C */ /* */ /* Asignatura: Inteligencia Artificial */ /* Grado en Ingenieria Informatica - UCA */ /*******************************************/ #include <stdlib.h> #include <stdio...
C
/* * This example program runs a full instance of chiventure with an in-memory game, * and where the CLI is monkeypatched to accept a new operation: * * - TASTE: A "kind 1" action that operates on an item. We support customization for the * output string upon running the action. */ #include <stdio.h>...
C
#include<stdio.h> #include<unistd.h> #include<sys/types.h> /* * Primeiro executa o pai, depois o filho. */ int main(void) { write(STDOUT_FILENO, "1\n", 3); if (fork() > 0) { //Papai write(STDOUT_FILENO, "2", 1); write(STDOUT_FILENO, "3", 1); } else { //Filho ...
C
#include <stdio.h> int main(void) { int input = 0; //get input from the program user scanf("%i", &input); printf("The value is: %i", input); }
C
#include <stdio.h> #include <string.h> void main () { int a, b, c, d;// = 1,2,3,4; //strlen("Rishabh"), strlen ("Puri"), 90, 81; a = 1; b = 2; c = 3; d = 4; printf ("a %d,b %d ,c %d ,d %d",a,b,c,d); }
C
/* ** EPITECH PROJECT, 2020 ** directory ** File description: ** fonction */ #include "my.h" char **map(int ac, char **av) { int av1 = my_atoi(av[1]); int z = 0; int y = 0; char **square = malloc(sizeof(char *) * av1 + 2); for (int i = 0; i != av1 + 2; i++) square[i] = malloc(sizeof(char) ...
C
#include <stdio.h> #include <stdlib.h> int main() { int i=0; int nro; printf("\Ingrese un numero: "); scanf("%d",&nro); printf("\n\tTabla del nro %d con WHILE", nro); while(i<11){ printf("\n %d x %d = %d", nro, i, nro*i); i++; } printf("\n\n\tTabla ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sortStone.c :+: :+: :+: ...
C
#include "../ft_btree.h" void btree_apply_suffix(t_btree *root, void (*applyf)(void *)) { if (!root) return; btree_apply_suffix(left, &applyf); btree_apply_suffix(right, &applyf); applyf(root->item); }
C
#include "common.h" #include "common/string_util.h" #include <sys/types.h> #include <unistd.h> #include <signal.h> static crash_func_t crash_func = NULL; static void *usr = NULL; static bool sigsegv_handler_init = false; static const char *log_path = NULL; static FILE *debug_file = NULL; #define DEBUG_FILENAME "debug...
C
#include <stdio.h> int main() { int a = 10, b = 4, res; // post-increment example: // res is assigned 10 only, a is not updated yet res = a++; printf("a is %d and res is %d\n", a, res); // a becomes 11 now // post-decrement example: // res is assigned 11 only, a...
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include "pomiar_czasu.h" #include <time.h> #include <math.h> //#include <unistd.h // build: gcc -I/usr/include -L/usr/lib64 main.c -lpthread -L pomiar_czasu.h pomiar_czasu.c typedef struct Dane {int a,b; int n, id, k; } Dane; double wynik = .0; pthread_m...
C
/*Задача 13.Опишете времето: часове:минути:секунди като структура tagTMyTime. Използвайки тази структура, дефинирайте следните функции: добавяне на секунди, добавяне на минути. добавяне на часове към дадена променлива от тип struct tagTMyTime. Напишете следните функции: връщане на броя секунди за дадена променлива от в...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char *array[4]; int x = 0; array[0] = "hello"; array[1] = "red"; array[2] = "blue"; array[3] = "green"; for(x = 0; x < 3; x++) { printf("%s", array[x]); printf("\n"); } return 0; }
C
/************************************************************************* > File Name: test.h > Author: ChongH > Mail: 304451676@qq.com > Created Time: 2018年10月06日 星期六 10时14分58秒 ************************************************************************/ #ifndef _TEST_H #define _TEST_H #include <stdlib.h> typedef s...
C
/*+ * United States Geological Survey * * PROJECT : Modular Modeling System (MMS) * FUNCTION : str_to_vals * COMMENT : decodes a string into values, and loads memory addresses * Examples of legal strings for this routine: * * "1 2 3 4 5" * "1.0, 2.2, 19e9" * "1*23...
C
/*SORU 1) Bir integer sayy parametre olarak alan ve bu saynn kpn hesaplayarak return eden fonksiyonu yaznz. */ #include <stdio.h> #include <conio.h> int kupbul(int a) { int carp=1; int i; for(i=1; i<=3; i++) { carp = carp * a; } return carp; } int main(void) { int z; z = kupbul(2); printf("%d",z); }
C
#include <pebble.h> #include "utility.h" static int outsideRange(int digit,int min,int max) { if (digit >= min && digit <= max) { return 0; } else { return 1; } } static void split_string (char **inarray, char *delimiter, char *instring) { int i; char *p; // for (i=0;i<3; ++i) { // APP_LOG(...
C
/* * sleepenh.c - enhanced sleep command * * Copyright (C) 2003 Pedro Zorzenon Neto * Copyright (C) 2014 Nicolas Schier <nicolas+debian@hjem.rpa.no> * * This program 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 Softw...
C
/* * Copyright (c) 2010-2016 TIBCO Software Inc. * All Rights Reserved. Confidential & Proprietary. * For more information, please contact: * TIBCO Software Inc., Palo Alto, California, USA * * $Id: fldref.h 90137 2016-12-13 19:04:42Z $ */ #ifndef _INCLUDED_tib_fldref_h #define _INCLUDED_tib_fldref_h #include "...
C
#include <stdio.h> char * my_strstr(char * text_to_be_searched, char * text_first_occurrence_is_serched_for); /* int main() { char a[] = "1234567aa"; char b[] = "aaaaaa"; printf("%s\n", my_strstr(a, b)); } */ char * my_strstr(char* lc, char* sc){ if(sc[0]=='\0') goto emptyNeedle; int i; ...
C
/** ****************************************************************************** * @file lcd16x2.c * @author Yohanes Erwin Setiawan * @version 1.0 * @date 6 Februay 2016 ****************************************************************************** */ /** Includes -----------------------------------...
C
#ifndef __STACK_H__ #define __STACK_H__ #include <stdbool.h> // structure struct stack_element { int value; struct stack_element *next; }; struct stack { struct stack_element *head; }; // fonctions struct stack *stack_new(); void stack_push(struct stack *, int); int stack_pop(struct stack *);...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> #include <time.h> // Train priorities #define HIGH 1 #define LOW 0 // Directions #define EAST 0 #define WEST 1 // Timer setup from Tutorial 7 #define BILLION 1000000000.0; struct timespec start, stop; double accum; /* * Struct to hold...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> char* crcRem(char* bitString, char* gPoly, int bsl, int gpl); char* crcGen(char* bitString, char* gPoly); char* crcCheck(char* codedString, char* gPoly); char xor(char a, char b); int main(int argc, char** argv) { if(argc != 3) { printf("Usag...
C
#include "holberton.h" /** * string_toupper - function to change the case to uppercase * * @string: string of which the case is to be changed * * Return: returns the string */ char *string_toupper(char *string) { char *p = string; while (*string != '\0') { if (*string >= 'a' && *string <= 'z') { *strin...
C
#include <stdio.h> #include <math.h> #include <limits.h> /** 1 2 3 5 8 9 3 7 9 12 14 2 1 0 2 i 0 1 j 0 0 Min 2 1 */ int getMin(int a, int b){ return a<b?a:b; } int findClosestElements(int a[], int b[]){ int counter, min, diff; int ai=0; int bi=0; min = INT_MAX; for(counter=0; counter<6; counter++){...
C
#include <stdio.h> #include <stdlib.h> int my_add(int x, int y); int main(int argc, char ** argv) { if (argc != 3) { printf("Usage: c_simple <x> <y>\n"); return 1; } int x = atoi(argv[1]); int y = atoi(argv[2]); int z = my_add(x, y); printf("%d + %d == %d\n", x, y, z); ret...
C
#include "header.h" /** * free_list_p - free list * @head: head node list */ void free_list_p(path_t *head) { path_t *tmp; tmp = head; while (head != NULL) { tmp = head; head = head->next; free(tmp->str); free(tmp); } free(head); } /** * node_len_p - length list * @h: list path * Return: integer l...
C
#include <stdio.h> #include <stdlib.h> // malloc, calloc, realloc // malloc doesn't do implicit initialization to the allocated space int main(){ //dynamic memory is always in the heap section int *p; int n; printf("Enter how many integers: "); scanf("%d", &n); //p = (int *)malloc(100); // ma...
C
#include <stdio.h> #include <string.h> int main(){ char nome[30]; int qtdLetras; printf("Digite uma palavra:"); scanf("%s", &nome); // while até que a pos do nome fosse = /0 // strlen qtdLetras = strlen(nome); printf("TOTAL DE LETRAS: %i", qtdLetras); return 0; }
C
/* Example of instantiating a WebAssembly which uses WASI imports. You can compile and run this example on Linux with: cargo build --release -p wasmtime-c-api cc examples/wasi/main.c \ -I crates/c-api/include \ -I crates/c-api/wasm-c-api/include \ target/release/libwasmtime.a \ -lpth...
C
// 7 december 2014 // TODO verify header events (double-clicking on a divider, for example) static void makeHeader(struct table *t, HINSTANCE hInstance) { t->header = CreateWindowExW(0, WC_HEADERW, L"", // don't set WS_VISIBLE; according to MSDN we create the header hidden as part of setting the initial position...
C
/*------------------------------------------------------------------------* Developer: Lucas Ferreira Location: São Paulo - SP Creation date: 02/05/2021 Course: Self student *------------------------------------------------------------------------*/ #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <...
C
//DYNAMIC HASHING #include<stdio.h> #include<stdlib.h> typedef struct NODE{ int data; int key; }node; node *a[15]; int count=0; void insert(int,int); void display(); int main() { FILE *fp; int emp,key; fp=fopen("emp.txt","r"); printf("\nENTRY OF DATA USING FILE\n"); while(fscanf(fp,"%d",&emp)!=EOF) { ke...
C
typedef struct { size_t capacity; size_t bucket_size; size_t length; void*** buckets; size_t slot_size; } Pool; void initialize_pool(Pool* pool, size_t slot_size, size_t bucket_count, size_t bucket_size) { pool->capacity = bucket_size * bucket_count; pool->bucket_size = bucket_size; pool->slot_size =...
C
#include "shell.h" #include "fs_cmd.h" char ps_buffer[64]; // ourShell的主函数 void osh() { // 初始化 char cmd[MAX_COMMAND_LENGTH]; kernel_clear_screen(); // 原ZJUNIX怎么还PowerShell的 kernel_puts("OurShell Starts!\n\n"); print_prompt(); while (1) { // 从标准输入读入,传给解析器解析 if (read_lin...
C
/* ------------------------------------- File: 108t1.c Project: avl.c file description ------------------------------------- Author: Kathleen Milligan ID: 160458550 Email: mill8550 Version 2018-03-05 ------------------------------------- */ #include "avl.h" int main() { struct Node *root = NULL; /* Co...
C
/* * File: 1..c * Author: Christopher Roldan Sanchez * Mail: Christopher_Rol@hotmail.es * Date: * Description: * * Materia: Programacion avanzada * Universidad: Universidad Argentina De La Empresa (UADE) * Docente: Iervasi Scokin, Juan Jose * * Ejercicio: * 4. Realizar una funcin que devuel...
C
/************************************************************************* > File Name: pthread.c > Author: bianyilin > Mail: 732406982@qq.com > Created Time: 2019年06月02日 星期日 19时48分46秒 ************************************************************************/ #include <stdio.h> #include <pthread.h> #include <unis...
C
struct Node { void *data; //holds data struct Node *next; }; struct stackPointer { struct Node *head; int size; }; int push(struct stackPointer *const sp, const void *data){ struct Node *newNode = (struct Node*) malloc(sizeof(struct Node)); if(newNode == NULL) //malloc fails ...
C
#include <stdio.h> #define PI_APPROXIMATION 3.14159 double area_of_circle(double radius) { return (PI_APPROXIMATION * radius * radius); } int main(void) { double radius; scanf("%lf", &radius); printf("A=%.4f\n", area_of_circle(radius)); return (0); }
C
// // 顺环队列的实现(数组实现) // 这种方案要注意的是 // 1、队列满空的判断条件是什么 // 2、以及为什么会出现空、满无法区分?根本原因? // 判别队列的状态,是根据front和rear的相对距离,这种相对距离,对于大小为N的数组,从0至(N-1),一共有N种情况 // 而队列装载的元素却可以有N+1种(从0到N)情况, 用N中相对距离,去区分N+1中情况,显然是做不到的 // 有两种解决方式: // 1、使用额外的标记, size(队列中元素个数,若个数达到MaxSize则满,若个数为0为空,对应了增加和删除操作时候对size的修改) // 或者tag(tag=1,最有一次操作为添加,tag=0,最后...
C
#include <stdio.h> #include <math.h> #define f(i,n) for(i=0;i<n;i++) #define sd(n) scanf("%d",&n) #define sc(n) scanf("%c",&n) #define slld(n) scanf("%lld",&n) #define mod 1000000007 #define ll long long #define gc getchar_unlocked #define pc putchar_unlocked inline unsigned ...
C
#include "include/ptypes.h" void create_operation(operation* op, producer opr) { op->opt = opr; } void destroy_operation(operation* op) { free(op); } void create_decl(var_decl* declaration, char* identifier, int literal, operation* op, int value, int line) { declaration->identifier = identifier; dec...
C
/******************************************************************************************************* * : RS485ͨ(뷢) * * * * 1.ͨ˽⴮ڵĻԭʹ ,ⲢնԴڽгʼ * * * * 2.ʹôڵ֣Baud 9600λ...
C
#ifndef STACK_H #define STACK_H /* This is C implementation of a stack data type containing integers * The stack is implemented using a dynamically allocated array. */ typedef struct { /* The poiter to the base of the stack * A new element will be insterted at base + LSize location. * A pop will return...
C
#include "I2C.h" void I2C_write (uint8_t address, uint8_t thisRegister, uint8_t thisValue){ // Send START I2C_GenerateSTART(I2C1, ENABLE); while(!(I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_MODE_SELECT))); // Send address as transmitter I2C_Send7bitAddress(I2C1, address, I2C_Direction_Transmitter); while(!(I2...
C
#include "node.h" sl_node_t* new_node(void* data, size_t size_data) { sl_node_t *node = malloc(sizeof *node); if ( node == NULL ) return NULL; node->data = malloc(size_data); if ( node->data == NULL ) return NULL; memcpy(node->data, data, size_data); node->next = NULL; return n...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { srand(time(NULL)); int dizi[10],diziCift[10],diziTek[10]; int *diziPtr=&dizi; int *diziCptr=&diziCift; int *diziTptr=&diziTek; int i; printf("Random dizideki elemanlar\n\n"); for(i=0;i<10;i++){ *(diziPtr+i)=1+r...
C
#include <stdio.h> #include <stdlib.h> // int addSelf(int n); int main(int argc, const char **argv) { if (argc < 2) { printf("Program needs an integer argument\n"); return(-1); } int n = atoi(argv[1]); int fact = n + 2; printf("plusTwo(%d) is %d\n",n, fact); printf("first element of argv is %s\n",...
C
#include <stdio.h> // puts() NULL printf() scanf() fopen() fgets() fclose() // fprintf() #include <strings.h> // strcasecmp() #include <string.h> // strchr() strlen() #include <time.h> // time() #include <stdlib.h> // srand() rand() atoi() #include <unistd.h> // sleep() access() // Function declarat...
C
#include <stdio.h> #define MAXLINE 1000 int mygetline(char line[], int maxline); int insert(char line[], char x, int l, int len); int myremove(char line[], int l, int len); void replspaces(char line[], int len, int n); /* write a program that replaces tabs with the proper number of blanks to space to * the next tab ...
C
/* * Check if usual arithmetic conversion is well done. * Here, type of one opernd is `unsigned short int'. */ #include <stdio.h> void test00(unsigned short int a, long double b) { printf("%d + %Lf = %Lf\n", a, b, a + b); } void test01(unsigned short int a, double b) { printf("%d + %f = %f\n", a, ...
C
// ======================================================================================= // Extremely minimal bootstrap library. // // This implements the bare minimum of libc needed in order to be able to compile our // image resizer code. A real application would probably use Emscripten, which provides a // full C ...
C
/************************************************************* * The Suquential Solution of the N-Queens Problem * CIS750 * Yan Shi, CIS, Temple University * Oct., 1993 *************************************************************/ #include <stdio.h> #include <time.h> #include <sys/types.h> #define TRUE ...
C
// This is a program that takes 12 digits and sorts them in descending order, and checks whether they are numbers in it. It tells you how many digits are stored in it. #include <stdio.h> #define MAX 12 // 입력 값을 12개만 받는다. void swap(int* p, int* q) { // 정렬이 되지 않은 두 숫자의 위치를 바꿔주는 함수. int temp; temp = *p; *p = ...
C
/* * raylib-line-triangulator -- line triangulation algorithm for raylib * * LICENSE: zlib * * Copyright (c) 2020 Taras Radchenko (@petuzk) * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use...
C
#include<stdio.h> int main() { int m; scanf("%d",&m); int n; scanf("%d",&n); int arr[m][n]; //inputting the array for(int i=0 ; i<m ; ++i) for(int j=0 ; j<n ; ++j) scanf("%d",&arr[i][j]); int x=1,j=0 ; for(int i=0 ; i<m ; ++i) { for(; ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <netdb.h> #include <sys/socket.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <dirent.h> #include <sys/stat.h> #include <stdbool.h> #include <time.h> #include <arpa/inet.h> #define LINEMAX 256 char * per...
C
/* ******************************** ilist.h ********************************* */ /* Soubor: ilist.h */ /* Datum: prosinec.2016 */ /* Predmet: Formalni jazyky a prekladace (IFJ) ...
C
// c 的 .h 文件 // 头文件一般用于放置:需要向外暴露的宏定义,全局变量声明,函数声明 // 防止同一文件的二次编译。比如你有两个 c 文件,这两个 c 文件都 include 了同一个头文件,在编译时,这两个 c 文件就会被一同编译,那么就带来了声明冲突的问题 #ifndef _MYHEAD_HELLO_ // 是 if not defined 的缩写,如果没定义 _MYHEAD_HELLO_ 则执行这一块 #define _MYHEAD_HELLO_ // 定义 _MYHEAD_HELLO_ // 在 c++ 中写 c 语言代码 #ifdef __cplusplus // 如果当前是 c++ 环境 ...
C
#include <string.h> #include <stdlib.h> #include <stdio.h> /* special chars */ const char * const specialc_table[] = {"=", "<", ">", ";"}; /* keywords */ const char * const keywords[] = { "if", "else", "while", "then", "int", "float", "bool" }; size_t size_keywords = (sizeof(keywords) / sizeof(char *)); /*...
C
#include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <fcntl.h> #define _OPEN_SYS #include <pwd.h> #include <libutil.h> #include <errno.h> #include <time.h> #include <string.h> #include <unistd.h> int pw_equal(const struct passwd *_pw1, const struct passwd *_pw2); int pw_copy(int ffd, int tfd, const ...
C
#include <stdio.h> int main() { int k, count; printf("Ввести целое число\n"); scanf("%d", &k); for (count = 1; count < k; count++) { if (count % 5 == 0) continue; printf("\t%d\n", count); } return 0; }
C
#ifndef _LINKED_LIST_H_ #define _LINKED_LIST_H_ #include "common.h" /* Protocol data type nodes with the use of linked lists. */ typedef struct client_node { client_t *client; struct client_node *next_client; } client_node_t; typedef struct track_node { track_t *track; struct...
C
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <queue.h> #define TEST_ASSERT(assert) \ do { \ printf("ASSERT: " #assert " ... "); \ if (assert) { \ printf("PASS\n"); \ } else { \ printf("FAIL\n"); \ exit(1); \ } \ } while(0) /* static int inc_item(void *data, void ...
C
#include "string.h" /* Нахождение размера строки @param a [in] @return Возвращает количество элементов в строке */ int my_sizeof(const char *a) { int i = 0; while (a[i + 1] != '\0') i++; return ++i; } /* Получение из целого числа строки @param str [out] @param x [in] */ void int_to_str(char *st...
C
/* filename: seq.c * author: daniel collins (dcollins3@zagmail.gonzaga.edu) * date: 3/27/15 * brief: quicksort and bubble sort includes for lab5 */ #include <stdio.h> void quicksort (int *a, int n) { int i, j, p, t; if (n < 2) return; p = a[n / 2]; for (i = 0, j = n - 1;; i++, j--) { ...
C
#include <stdio.h> #include <stdlib.h> #include <windows.h> #include "wintrace.h" void run_cmd(LPTSTR cmd) { STARTUPINFOA si; PROCESS_INFORMATION pi; ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); ZeroMemory(&pi, sizeof(pi)); if (CreateProcess(NULL, cmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &s...
C
#include <stdio.h> int main(){ int i; for(i=1;i<=20;i++){ if (i==10) continue; //break; printf("%d\n",i); } }
C
#include <stdlib.h> #include <time.h> #include <stdio.h> /** * main - If * Description: Print the last number positive or negative * Return: 0 */ int main(void) { int n; int a; srand(time(0)); n = rand() - RAND_MAX / 2; a = n % 10; printf("Last digit of %i is %i and is ", n, a); if (a > 5) { printf("greater than 5\...
C
#include "avltreedelete.h" void deleteNode(AVLTree *avltree, int value) { Node *node = findNode(avltree, value), *successor = NULL, *child, *parent; if(node) { // convert to a case with 1 or 0 child if(node->left && node->right) { // min max, successor and predecessor won't change ...
C
/************************************************************************* > File Name: str.c > Author: Datou_Nie > Mail: niehaokang@gmail.com > Created Time: 2017年08月02日 星期三 20时01分00秒 ************************************************************************/ #include<stdio.h> #include<string.h> int main() { c...