language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* * File: graph.h * * Author: Alex Swindle (aswindle@email.arizona.edu) * * Purpose: Header file for graph.c giving public info about graph methods available */ #ifndef _GRAPH_H #define _GRAPH_H /* * Typedefs */ typedef struct targetNode { int isTarget; int visited; char *name; struct depende...
C
#include <stdio.h> #include <string.h> /** * main - Entry point * * Return: Always 0 (success) * */ int main(void) { char up; for (up = 'z'; up >= 'a'; up--) { putchar(up); } putchar('\n'); return (0); }
C
#include <stdio.h> int main() { int a[10][10],m,n,i,j; int *p=&a; printf("Enter the size of matrix: "); scanf("%d %d",&m,&n); printf("Enter the elements of matrix:\n"); for(i=0;i<m;i++) { for(j=0;j<n;j++) scanf("%d",*(a+i)+j); } for(i=0;i<m;i++) { for(...
C
/** * Note: The returned array must be malloced, assume caller calls free(). */ //1、对每一个元素寻找在nums2中的下一个更大元素O(n2) //但存在一个特性:num1是num2的子集,能不能改进 //2、先对nums2进行快排O(nlogn)再寻找下一个更大元素 //用散列表存储用到O(n),可能比第一种方法更快 //值(key)--num2快排后新位置(value) //有问题,是下一个更大元素而不是数组中比他更大的下一个元素,所以不进行快排了 //那么转换为找到每一个在nums2中的位置然后每一次都寻找下一个更大的,但是可以保存每一个更...
C
#include <stdio.h> #include <malloc.h> #include <string.h> #include "../include/conversao.h" #include "../include/bmp.h" #include "../include/operacaoPixel.h" #define GRAY_LEVELS 256 int read_bmp_header(char *file_name,bitmapheader *bmp_header); int read_bmp_file_header(char *file_name,bmpfileheader *file_heade...
C
#include <unistd.h> int ft_strlen(char *str); int ft_atoi(char *str); void ft_putnbr(int nb); void ft_putnbr_base(int nbr, char *base); void ft_putstr(char *str); int ft_atoi_base(char *str, char *base); int main() { ft_putstr("using ft_putstr for stdout\n"); ft_putstr("ft_strlen\n"); if (5 == ft_strlen("bella")...
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 "shopGen.h" #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include <time.h> #include "../Utilities/utilities.h" #include "../RPGutilities/convertFromCp.h" #include "nameGen.h" #include "flagDefines.h" struct shopItem{ char name[NAME_LENGTH]; uint32_t lowPrice; /* lowest pr...
C
#include "capture.h" int main(int argc, char *argv[]) { pcap_t *pd = NULL; char ebuf[PCAP_ERRBUF_SIZE]; if (argc < 2) { perror("usage: <if name>\n"); exit(EXIT_FAILURE); } if ((pd = pcap_open_live(argv[1], DPCP_RCV_MAXSIZE, DPCP_PROMSCS_MODE, DPCP_RCV_TIMEOUT, ebuf)) == NULL) ...
C
#include <stdio.h> #include "rules.h" #include "util.h" struct lrule { prover_rule_function rule; bool (*is)(struct proof_sequent *sequent, int index); const char *name; const char *latex_name; bool invertible; }; struct rrule { prover_rule_function rule; bool (*is)(struct proof_sequent *...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> #include<assert.h> #include<stdbool.h> #include<limits.h> #include<setjmp.h> static jmp_buf exception_env; static int exception_type; int min(int a,int b){return a<b?a:b;} int max(int a,int b){return a>b?a:b;} char buff[1000000]; char*getstr(){...
C
/* ============================================================================ Name : RTVideo.c Author : Matteo Rotundo ============================================================================ */ #include <stdlib.h> #include <stdio.h> #include <ctype.h> #include "Draw.h" #include "Sched_new.h" #in...
C
// // Created by yejiongtao on 2019/4/29. // #include "reed_solomon.h" #include "galois.h" #include "matrix.h" #include "coding_loop.h" #include <stdio.h> #include <stdlib.h> #include "cuda_encoder.h" char *matrix = NULL; // total_shard_count x data_shard_count char *parity_rows = NULL; // parity_shard_count ...
C
#include "/room/clean.c" reset(arg) { if(!arg) set_light(1); } id(str) { return str == "sign"; } short() { return "The Crossroads [n,s,e,w]"; } long(str) { if(str == "sign") { write("The sign is basically a large wooden pole with planks pointing\n"); write("in the directions of the roads.\n")...
C
#include "listaencad.h" #include <stdlib.h> #include <stdio.h> struct cel{ int dado; struct cel *prox; }; celula *cria(){ celula *c; c = (celula *) malloc(sizeof(celula)); c->prox = NULL; return c; } void insere(celula *c, int val){ celula *nova; nova = (celula *) malloc(sizeof(celula)); nova->dado = val...
C
#include <stdio.h> #define MAX 300 int contador = 0; int ocorrencias (char *palavra, int i){ if (palavra[i+2] == '\0') return contador; else if (palavra[i] == palavra[i+2]){ contador++; return contador + ocorrencias (&palavra[i+1], i); }else return contador + ocorrencias ...
C
#include <stdio.h> int main() { int edge1,edge2,edge3; printf("\n\t PLEASE ENTER THE EDGES OF THE TRIANGLE \n"); printf(" \n\tEdge 1 : "); scanf("%d",&edge1); printf(" \n\tEdge 2 : "); scanf("%d",&edge2); ...
C
/* * Copyright (C) 2019 Intel Corporation * * SPDX-License-Identifier: BSD-3-Clause */ #include <stdio.h> #include <stdlib.h> #include "app.h" bool load_enclave_state(const char *const statefile) { void* new_buffer; size_t new_buffer_size; printf("[GatewayApp]: Loading enclave state\n"); bool ...
C
//------------------------------------------------------------------------------ // Headers //------------------------------------------------------------------------------ #include <string.h> #include <dbgu/dbgu.h> #include <stdio.h> #include "dfm_console.h" #include "dfm_entry.h" #include "dfm_cmd.h" //---...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* test_stat.c :+: :+: :+: ...
C
#include <stdio.h> #include "buffer/ptr_buffer.h" #include "testing/unity/unity_2_4_1/src/unity.h" #include "testing/unity/unity_2_4_1/extras/fixture/src/unity_fixture.h" static ptr_buffer_t *b; char *test1 = "This is a string."; char *test2 = "Here is another."; char *test3 = "Yet another string."; char *test4 ...
C
#include <stdio.h> int main(void) { float celsius; float farenheit; float kelvin; for(celsius =-5; celsius <= 40; celsius++) { farenheit = (celsius * 9 / 5) + 32; kelvin = (farenheit - 32) * 5 / 9 + 273.15; printf("%.2f Grados Celsius equivalen a %.2f Grados Farenheit\n", c...
C
#include "lists.h" /** * *add_nodeint - function that adds a new node at the beginning of a list * @head: pointer head * @n: list * Return: the address of the new element, or NULL if it failed */ listint_t *add_nodeint(listint_t **head, const int n) { listint_t *nodo; if (head == NULL) { return (NULL); } nodo =...
C
#include "libft_convert.h" #include "libft_string.h" t_char* ft_s32_to_str(t_s32 nbr) { t_char temp_buffer[SIZE_S32_BUFFER]; t_size i; t_sint nbr_sign; i = 0; nbr_sign = POSITIVE; if (nbr == 0) temp_buffer[i++] = '0'; else if (nbr < 0) { nbr *= -1; nbr_sign = NEGATIVE; } ...
C
#include <pthread.h> #include <stdio.h> #include <sys/syscall.h> #include <sys/types.h> #include <unistd.h> void* threadID(void* arg) { long t = *(int *)arg; //O tipo da variavel é long pela mesma explicaçao dada em ex1d.c printf("TID: %ld PID: %d\n", syscall(SYS_gettid), getpid()); //syscall(SYS_g...
C
#include<stdio.h> int main() { int i,k,n,m[1000],j,count = 0; scanf("%d %d",&k,&n); for(i = 0;i < k;i++) { scanf("%d",&m[i]); } for(i = 0;i < k;i++) { if(m[i] >= m[n-1]&&m[i]>0) { count++; } } printf("%d\n",count); ...
C
#ifndef UI_H #define UI_H typedef struct Ui Ui; typedef struct UiWin UiWin; enum UiLayout { UI_LAYOUT_HORIZONTAL, UI_LAYOUT_VERTICAL, }; enum UiOption { UI_OPTION_LINE_NUMBERS_NONE = 0, UI_OPTION_LINE_NUMBERS_ABSOLUTE = 1 << 0, UI_OPTION_LINE_NUMBERS_RELATIVE = 1 << 1, }; #include <stdbool.h> #include <stdarg...
C
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { char c; double q,q1; q = 0.0; int n,i; scanf("%d",&n); double l[n],g[n],r[n]; for(i = 0;i < n;i++) { scanf("%lf%lf%lf",&l[i],&g[i],&r[i]); } int k; scanf("%d",&k); getchar(); scanf("%c",&c); if(c == 'L') { for(i = 0;...
C
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> int FD = 1; /* Ajouter export MCAT_BUFSIZ=16 dans le terminal */ char* inverser(char tab[]){ int i; int j=strlen(tab)-1; char temp; for (i = 0; i <j; +...
C
//Arrays are only passed by address(Using pointers) #include<stdio.h> void array(int a[],int n){ //Or we can use int *a as a[] is also denoting a pointer for array for(int i=0;i<n;i++) printf("%d ",i[a]); // Or we can write *(a+i) as a is the address of first num in array } //#### FOR ARRAY A...
C
#include <stdio.h> #include <stdlib.h> int funkcja(int n) { if(n==0||n==1) { return 1; } return 2*funkcja(n-1); } int main() { int a; scanf("%i",&a); printf("%i",funkcja(a)); }
C
/************************************************************************* > File Name: client.c > Author: yanghang > Mail: 2459846416@qq.com > Created Time: Thu 06 Dec 2018 07:47:49 PM CST ************************************************************************/ #include<stdio.h> #include<stdlib.h> ...
C
#define _CRT_SECURE_NO_DEPRECATE #include "Link.h" #include<stdio.h> #include<stdlib.h> #include<Windows.h> void fun(); /*ۺϹܺ*/ /**/ int main() { fun(); system("pause"); return 0; } /*ۺϹܺ*/ void fun() { int c,stu_num = 0,choice =0; char ch; struct LINK_NODE *head = NULL; system("cls"); ...
C
#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <err.h> #include <dynamic.h> #include "reactor.h" struct client { reactor_net net; reactor_http http; reactor_vector target; }; static reactor_status net_handler(reactor_event *event) { struct cl...
C
/* * Copyright 2010 Sébastien Aupetit <sebastien.aupetit@univ-tours.fr> * * This source code is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/types.h> // Define BUFSIZE 1024 int main(int argc, char const *argv[]) { int c; pid_t pid = getpid(); /* get current processes*/ printf("My pid: %d\n", pid); c = fgetc(stdin); exit(0); }
C
#include <enet/enet.h> #include <stdio.h> int main(int argc, char **argv) { if (enet_initialize() != 0) { fprintf(stderr, "An error occurred while initializing ENet.\n"); return EXIT_FAILURE; } atexit(enet_deinitialize); ENetAddress address; address.host = ENET_HOST_ANY; address.port = 5000; ...
C
#define FOR_TEST #include <stdio.h> #include <stdlib.h> #include <math.h> #include "Mutation.h" #include "Constraints.h" #include "Structure.h" #include "TestStructure.h" #include "Timetable.h" #include "Random.h" /**************************************************************************** * Function name : perfo...
C
#include "Tests.h" void runTests() { testOffert(); testDynamicallyAllocatedArray(); testRepository(); testService(); } void testOffert() { CreateOffert_AnyOffert_OffertCreated(); DestroyOffert_ExistingOffert_OffertDestroyed(); GetID_ExistingOffert_OffertID(); GetType_ExistingOffert_OffertType()...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
/***************************************************************************** FILE: datei.c (AK) COMPILE (& link) with: gcc -o datei datei.c -Wall -Werror ******************************************************************************/ // #include <stdio.h> // printf, fgets #include <fcntl.h> #include <stdlib....
C
#include "isogram.h" #include <string.h> char toLowerCase(char c){ if (c >= 'A' && c <= 'Z') { return c - ('A' - 'a'); } return c; } bool isanumber(char c) { return(c>='0'&& c<='9'); } bool isatallchar(char c) { return (c>='A'&& c<='Z'); } bool isasmallchar(char c) { return (c>='a'&& c<...
C
#include <stdio.h> _Bool comparador(char s1[], char s2[]){ int c = 0; while(s1[c] == s2[c] && s1[c] != '\0' && s2[c] != '\0'){ c++; } if(s1[c] == '\0' && s2[c] == '\0'){ return 1; }else { return 0; } } int main(){ char str1[30], str2[30], str3[30]; sc...
C
#include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include "mqtt.h" static MQTT_CONFIG_T s_ClientCfg; /**< log*/ static void mosq_log_callback(struct mosquitto *hMosq, void *userdata, int level, const char *str) { /* Pring all log messages regardless of level. */ } /**< recv*/ stati...
C
#define _XOPEN_SOURCE 500 #include <fcntl.h> #include <stdio.h> #include <unistd.h> #include "error.h" int main(int argc, char* argv[]) { if (argc != 4) { err("usage: %s command1 command2 file", argv[0]); } char* cmd1 = argv[1]; char* cmd2 = argv[2]; char* filename = argv[3]; FILE* pipe_in = popen(cm...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_treat_input.c :+: :+: :+: ...
C
#include <stdio.h> #include <math.h> #include <stdlib.h> #define MAX 40 int main() { FILE *in,*out; char line[MAX]; float lattice; printf("the type of lattice:\n"); if ((in = fopen("POSCAR", "w")) == NULL) { fprintf(stderr,"I couldn't open POSCAR\n"); exit(1); } printf("please input the first line\n")...
C
/* * 我们可以假设物品就是按编号顺序来选择的,某个物品不被选上可看作被选用了0个。 * 这样的话,我们的问题就是在5种物品里选择,以满足重量体积限制,并使总价值最大。 * 按顺序在5种物品里选可以分解为先在前4种物品里选,最后确定最后一种物品怎么选, * 一般地,要在前n种物品里选,可以先看作在前n-1种物品里选,最后选第n种, * 但我们要用一个状态(也就是子问题)来记录前n-1种物品选择的状态,目标是使目标问题能递归的分解成子问题, * 但要注意状态数目不能太多,否则内存可能不够。我们定义子问题如下:在前n种物品里选择, * 满足总体积为x和总重量为y的条件下,总价值最多是多少? * 记这个最大总价值为f(n...
C
/* Matrix element access function (using C indexing: 0..(m-1), 0..(n-1)) */ /* num_rows is the size of one column (number of rows in one column) */ #define el_indx(row, column, num_rows)\ (((column) * (num_rows)) + (row)) void point_coord(const mxArray *vertices, int vertex, double center[3]); void face_center(co...
C
#include <notez.h> NotezDB *notez_init(char *filename) { NotezDB *ndb; int status; char *errMsg; errMsg = NULL; ndb = (NotezDB *) malloc(sizeof(NotezDB)); status = sqlite3_open(filename, &(ndb->db)); if (status) { fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(ndb->db...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "algo.h" #define NDIGITS 16 static const char *menu = "\n __________________________________________________________________\n1-Enter Number of routers\n2-Enter Cost between routers \n3-Build Routing Table for Each Router\n4-Out Optimal Path and Minim...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #define VIDE 0 typedef enum {SOURIS, LION, ELEPHANT} typePiece; typedef enum {NOIR, BLANC} couleurPiece; typedef enum {S, L, E, s, l, e} caracterePiece; struct position { int x; int y; }; struct piece { typePiece type; c...
C
/* * basis.c: WFA initial basis files * * Written by: Ullrich Hafner * * This file is part of FIASCO (Fractal Image And Sequence COdec) * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> */ /* * $Date: 2000/06/25 16:38:06 $ * $Author: hafner $ * $Revision: 5.3 $ * $State: Exp $ */ #...
C
#include "holberton.h" /** * _memset - copies the character b (an unsigned char) to the first n * characters of the string pointed to, by the argument str. * @s: pointer to string * @b: replacement character * @n: number of times to replace b variable * Return: (s)tring */ char *_memset(char *s, char b, unsigned...
C
#define _CRT_SECURE_NO_WARNINGS 1 // ShuruxinxClient.cpp : ͻ˳ûԴӼϢ͸ // #include "stdafx.h" #include <WinSock2.h> #include <WS2tcpip.h> #include <Windows.h> #include <WinBase.h> #pragma comment (lib,"ws2_32.lib") #define SERVER_PORT "27015" #define BUFFER_LEN 512 int _tmain(int argc, _TCHAR* argv[]) { struct addrinf...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_printf_d.c :+: :+: :+: ...
C
#include "Generator.h" // {;DnơC void generate(Tree *tree, SymTable *symTable, char *asmFile) { // NR tree ରզXy asmFile char nullVar[100]=""; Generator *g = GenNew(); // }ҲզXyɥHKX g->symTable = symTable; ...
C
#include <stdio.h> #include <stdlib.h> #include <locale.h> void main() { int qtd, codigo; float valor_pagar; setlocale(LC_ALL, "Portuguese"); system("color 4E"); printf("\nOpes do cardpio Valor\n"); printf("\n ------------------------------------------\n"); printf("\n| 100 ...
C
/** @file KISA_SHA_256.h @brief SHA256 암호 알고리즘 @author Copyright (c) 2013 by KISA @remarks http://seed.kisa.or.kr/ */ #ifndef SHA256_H_ #define SHA256_H_ #if WIN32 || KISA_WINMO_32 typedef unsigned __int64 uint64_t; typedef unsigned int uint32_t; typedef unsigned int uint16_t; typedef unsigned char uint8_t; #else #...
C
#include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <ctype.h> #include <string.h> int main(int argc, string argv[]) { // Abrir o arquivo com Comando em Linha // Comando em linha deve ter argc = 2 if (argc != 2) { printf("Usage: ./caesar key\n"); exit(1); } else { ...
C
#include <net/routing.h> static struct address * broadcast_next_hop(struct node *node, struct address *from, struct address *to); static int broadcast_recv(struct node *node, struct packet *packet); struct router broadcast_router = { .name = "broadcast", .next_hop = broadcast_next_hop, .recv = broadcast_recv, }; ...
C
/* * This file contains the ini and command liner parser main. */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> #include <string.h> #include <errno.h> #include <limits.h> #include <stdlib.h> #include <math.h> #include <float.h> #include "parse.h" #include "debug.h" #include "options.h...
C
#define _XOPEN_SOURCE 600 // required for barriers to work #include <stdlib.h> #include <stdio.h> #include <pthread.h> #include <unistd.h> void *hello_world() { printf("hello world!\n"); srand(time(NULL)); int r = rand() % 5; sleep(r); pthread_exit(0); } void *goodbye() { printf("goodbye\n...
C
#include <stdio.h> int main(){ int N, i, h, d, g; scanf("%d", &N); for (i = 0; i < N; i++){ scanf("%d %d %d", &h, &d, &g); if ((h >= 200 && h <= 300) && (d >= 50) && (g >= 150)){ printf("Sim\n"); } else { printf("Nao\n"); } } retur...
C
/* Name - Arpit Singh Roll number - 111601031 Program : This program is suppose to find the shortest path between x and y in the graph */ //including the important libraries #include <stdio.h> #include <stdlib.h> #include <limits.h> #include <string.h> #include <stdbool.h> //including the header files #include "gra...
C
#include <stdio.h> int main(void) { int t1, t2, t3, t4, t5, t6, t7, t8, hh, mm, user_time, prev_diff; t1 = 8 * 60; t2 = (9 * 60) + 43; t3 = (11 * 60) + 19; t4 = (12 * 60) + 47; t5 = (14 * 60); t6 = (15 * 60) + 45; t7 = (19 * 60); t8 = (21 * 60) + 45; printf("%d, %d, %d, %d, %d, %d, %d, %d\n", t1,...
C
#include <stdlib.h> #include <string.h> #include <stdio.h> #define SIZE 100000000 //#define SIZE 21474836480 /* #define TEST */ int main() { /* array a containing primes */ char* a = malloc(SIZE * sizeof(char)); /* initialize the array with everything * prime to be ruled out by main l...
C
/* ********************************************************* * * * Autor: Igor Martins * * Data: Maio de 2017 * * https://github.com/igormartins4 * * Laboratório de Algoritmo...
C
#include <stdio.h> #include <math.h> int min(int [], int ); int max(int [], int ); float avg(int [], int ); float stdDeviation(int [], int ); int main() { int len; printf("Enter length of array: "); scanf("%d",&len); int arr[len]; printf("Enter elements:\n"); for (int i = 0; i < len; ++i) { scanf("%d",&arr[i...
C
#include <csv_writer.h> #include <stdio.h> int main(){ // create a variable 'csv' of type csv (definition in lib/csv_writer.h) csv csv; csv.fname = "/tmp/test.csv"; // set file name to create / appen rows csv.columns = "ab;cd;ef;gh"; // define columns separated by your symbol of choice create_csv(&csv); //...
C
#include "holberton.h" #include <stdlib.h> /** *array_range - creates an array of ints *@min: minimum value *@max: maximum value *Return: pointer to new array, NULL if min less than max and fail */ int *array_range(int min, int max) { int *f; int g, d; if (min > max) { return (NULL); } d = max - min + ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "trie.c" #define CHAR_SIZE 26 // possible adjacent X, Y coordinates on board const int DX[] = {1, 0, -1, 1, 1, 0, -1, -1}; const int DY[] = {1, 1, 1, 0, -1, -1, -1, 0}; char **foundWords; int *foundPoints; int numFoundWords = 0;...
C
/* ============================================================================ Autoren : Lars Kahlert & Julia Olbrich Klasse : FA13 Projekt: Sudoku Dateiname : databaseUI.c Datum : 31.05.2017 Beschreibung: DatabaseUI stellt alle Menüs im Zusammenhang mit der Datenbank dar, so z.B. die Anzeige des Bestenl...
C
#include "msock.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <poll.h> #define MULTICAST_SO_RCVBUF 300000 #define FD_NUM 2 SOCKET sockv4; /* Socket */ SOCKET sockv6; /* Socket v6 */ char *recvBuf; /* Buffer for received data */ static void print_sockaddr(struct sockaddr_i...
C
/* * Filename: zt_macros.h * Description: common macro definitions * * Author: Jason L. Shiffer <jshiffer@zerotao.org> * Copyright: * Copyright (C) 2000-2010, Jason L. Shiffer * See file COPYING for details * * Notes: * */ #ifndef _ZT_MACROS_H_ #define _ZT_MACROS_H_ #include <zt.h> BEGIN_C_DECLS...
C
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: queueCartao.h * Author: João * * Created on 4 de Maio de 2017, 17:00 */ #ifndef QUEUECARTAO_H #d...
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 <stdio.h> #include <stdlib.h> void quickSort(int *a,int length,int start,int last){ int index; if(start == last) return ; index = Partion(a,length,start,last); if(index > start) quickSort(a,length,start ,index-1); if(index < last) quickSort(a,length,index+1,las...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <dirent.h> #include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> int main(int argc, char *argv[]) { if(argc < 2) { printf("too few arguments:\n"); exit(0);} int i; int fd; struct stat buf; char ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { double x, y; printf("Please input x: \n"); scanf("%lf",&x); // %lf%f y = (exp(x)+exp(-x))/2; printf("y = %f\n",y); // %f%lf system("pause"); return 0; }
C
#include <stdio.h> int main() { int num1, num2, gcd; /* get the input values from the user */ printf("Enter your first number:"); scanf("%d", &num1); printf("Enter your second number:"); scanf("%d", &num2); /* take smallest value to manipulate gcd...
C
#include "func.h" int tranFile(int new_fd) { train t;//定义发送数据的结构体 int ret; t.dataLen=strlen(FILENAME); strcpy(t.buf,FILENAME); //发送文件名给客户端 ret=sendCycle(new_fd,(char*)&t,4+t.dataLen); if(-1==ret) { return -1; } int fd=open(FILENAME,O_RDONLY); //发送文件大小给客户端 struct stat buf; fstat(fd,&buf); t.dataLen=size...
C
#include<stdio.h> #include<stdlib.h> struct node{ int value; struct node *link; }; struct node* insertAtFront(struct node* head,int val){ struct node* newNode; newNode = (struct node*)malloc(sizeof(struct node)); if(newNode == NULL){ printf("new block is not creating\n"); return hea...
C
#ifndef NANOBLAS_INTERNAL_MACRO_H #define NANOBLAS_INTERNAL_MACRO_H /** * @defgroup INTERNAL Internally used functions / macros * \{ * @defgroup MACRO Internally used macros * \{ */ /** * @name Fragments of symbol / type names * Typically they are concatinated to the “real” name by JOIN() macro. ...
C
// jcache.c #ifdef OPT_JAMFILE_CACHE_EXT #include <stdio.h> #include <stdlib.h> #include <string.h> #include "jam.h" #include "jcache.h" #include "filesys.h" #include "hash.h" #include "lists.h" #include "newstr.h" #include "pathsys.h" #include "parse.h" #include "rules.h" #include "search.h" #include "variable.h" ...
C
#include </home/evavw/classes/low_level_comp/assignments/lab6/staticLib/array.h> Vector create_vector(int length){ Vector vec; vec.vector = (double*)malloc(sizeof(double)*length); if(vec.vector == NULL){ vec.length = 0; vec.count = 0; return vec; //memory was not allocated } vec.count = 0; ...
C
#include <stdio.h> #include <stdlib.h> void exchange (char *ptr[], int j) { char *chtmp; char *chtmp2; chtmp2 = ptr[j + 1]; chtmp = ptr[j]; ptr[j + 1] = chtmp; ptr[j] = chtmp2; } int schr(char str[],char ch) { int i; int idx = -1; for(i = 0;(str[i] != '\0') && (str[i] != ch);i++); if(str...
C
#include "memory.h" #include "log.h" void* sk_malloc(size_t size) { void* ptr = malloc(size); if(ptr == NULL) { sk_log_error("Cannot allocate memory."); exit(1); } return ptr; } void sk_free(void* ptr) { free(ptr); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_cd.c :+: :+: :+: ...
C
#ifndef SD_SENSOR_I2C_H #define SD_SENSOR_I2C_H #include <byteswap.h> extern "C" { #include <linux/i2c-dev.h> #include <i2c/smbus.h> } int16_t read_word(int fd, int address) { int16_t value = (unsigned short )i2c_smbus_read_word_data(fd, address); return __bswap_16(value); } int8_t r...
C
/* * arrayListInt_Flexible.c * * Created on: 24-Dec-2018 * Author: jithin */ #include "arrayListInt_Flexible.h" arrayListtype_flexible* new_arrayListtype_flexible (u_long len, u_long upperLimit) { arrayListtype_flexible *list = (arrayListtype_flexible *) helper_calloc(1, sizeof(arrayListtype_flexible), ...
C
/* DIGCHECK vrifie l'aide d'une cl (produite par le mcanisme mis en oeuvre dans DIGCAT.C) la validit d'un matricule de 8 chiffres. */ #include <stdio.h> /* printf, scanf */ #include <conio.h> /* getch */ main()...
C
#include <stdio.h> #include <math.h> int main(void) { int N,W,H,i,length; scanf("%d %d %d",&N,&W,&H); for(i=0;i<N;i++) { scanf("%d",&length); if(length<=sqrt((W*W)+(H*H))) printf("DA \n"); else printf("NE \n"); } return 0; }
C
typedef struct Element { int value; struct Element *next; } Element; typedef struct Stack { struct Element *top; int length; } Stack; Stack *newStack(); void destroyStack(Stack *stack); Element *newElement(int value); void push(Stack *stack, Element *element); Element *pop(Stack *stack);
C
#include <stdio.h> #define LARGO_MAXIMO 15 int maximo (float, int); int minimo (float, int); typedef enum{S=0,N=1} opc_t; int main(void){ opc_t opcion_elegida=S; float arreglo[LARGO_MAXIMO]; int i, largo_ingresado; float resultado; for(i=0;opcion_elegida==1;i++){ printf("Desea ingresar un numero?\nsi-->S\nno-->N\...
C
#include <stdio.h> #include <stdlib.h> #include <curses.h> struct threeNum { int n1,n2,n3; }; int main() { int n; struct threeNum num; FILE *fptr; if ((fptr = fopen("/home/anhtran/Documents/C/Aptech/Code_Aptech/CodeBai11/Bai70LapTrinhKhongKho/program1.bin","rb")) == NULL); { printf("ERROR!"); exit(1); } ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdbool.h> // http://www.inf.ufg.br/~hebert/disc/aed1/AED1_09_Pilas.pdf pode ajudar ; // https://www.cos.ufrj.br/~rfarias/cos121/filas.html // https://www.cprogressivo.net/2014/05/Filas-em-C-Como-Programar-Tutorial-Estrutura-de-Dados-Dinamica-Queue....
C
#include "heuristica.h" int **custo; No* **m_ponto; char *sujo; Pontos heuristica(Pontos entrada) { Pontos fecho, vetor_aux; fecho = fecho_convexo(entrada); grava_pontos(fecho, "fecho.txt"); int i, j; custo = aloca_matriz(entrada.n, -1); //Aloca matriz de ponteiros de No int tam = ...
C
#include <stdio.h> #include <string.h> void inverti(char s[]) { char tmp; int i, j = strlen(s) - 1; for (i = 0; i < j; i++) { tmp = s[i]; s[i] = s[j]; s[j] = tmp; j--; } } int main(int argc, char *argv[]) { if (argc != 2) { printf("Numero argomenti errato\n"); return -1; } inverti(argv[1]); ...
C
/* * Copyright (C) 1992 Michael Tiller * * Permission must be explicitly given by the author to use, copy, * modify, distribute and/or sell any portion of this code. This * code is provided "as is" without any expressed or implied warranty. * */ /* * $Id: Vector.c,v 1.5 1993/06/10 13:59:27 tiller Exp $ * C...