language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "log.h" void write_log(char *event, char *info) { clock_t end_t = clock(); float instant = (double) (end_t - start_t)/(CLOCKS_PER_SEC*100); FILE *log_file = fopen(log_dir, "a"); if(log_file == NULL) { perror("erro fopen()"); error_handler(); } fprintf(log_file, "%f ; %d ; %s ; %s\n", ins...
C
/* Area and Perimeter of circle program using pass by reference method. * Written by: Shreevathsa * Date: 14/01/2019 */ #include<stdio.h> void areaPeri(int , float *, float *); int main(){ int r; float area, periM; printf("Enter the radius of circle: "); scanf("%d", &r); areaPeri(r ,&area, &periM); printf("T...
C
#include <stdio.h> int isprime(unsigned int n); int main(void) { int i; printf("Hello, World\n"); for(i=0;i <=102; i++) { if(isprime(i)) printf("%d is prime.\n", i); } return 0; } // returns 1 if n is prime, 0 otherwise. int isprime(unsigned int n) { int f; if(n==1||n==0) return 0; ...
C
#include<stdio.h> int multiply(int a, int b); int main() { int number1, number2; printf("Enter two integer numbers: "); scanf("%d %d", &number1, &number2); printf("%d x %d = %d.\n", number1, number2, multiply(number1, number2)); return 0; } int multiply(int a, int b) { if (b == 0) return 0; if (b > 0) ...
C
/* * Program to control ICOM radios * * This is a ripoff of the utility routines in the ICOM software * distribution. The only function provided is to load the radio * frequency. All other parameters must be manually set before use. */ #include <config.h> #include "icom.h" #include <unistd.h> #include <stdio.h> #...
C
/* lock_hash.h * * Copyright (C) 2017 Alexandre Luiz Brisighello Filho * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ #ifndef LOCK_HASH_H_ #define LOCK_HASH_H_ /* lock_hash implement a simple hashes for mutex, semaphores and joins. I...
C
#include <stdio.h> #include <unistd.h> #include <time.h> // ctime, difftime #include <sys/types.h> #include <sys/time.h> //gettimeofday #include <sys/times.h> //times int global_int = 5; int main(int argc, char * argv[]) { time_t curtime; time_t oldtime; time(&oldtime); printf("current : %s \n", ctime(&oldtime))...
C
#include <stdlib.h> #include "api/sk_utils.h" #include "api/sk_service_data.h" struct sk_srv_data_t { sk_srv_data_mode_t mode; int _padding; void* data; // User maintain it, user is responisble for destroy it }; sk_srv_data_t* sk_srv_data_create(sk_srv_data_mode_t mode) { sk_srv_data_t* srv_data = ...
C
#include <stdio.h> #include <stdlib.h> void insertionSort(int *arr, int n) { int j, actual; for (int i = 1; i < n; i++) { actual = arr[i]; for (j = i; (j > 0) && (actual < arr[j-1]); j--) arr[j] = arr[j-1]; arr[j] = actual; } } int main() { int n; int *arr; scan...
C
/* Define a function max_of_three() that takes three numbers as * arguments and returns the largest of them. */ #include <stdio.h> int max(int num1, int num2) { if (num1 > num2) { return num1; } else { return num2; } } int max_of_three(int num1, int num2, int num3) { i...
C
/* @(#)s_asinh.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided...
C
#include <stdlib.h> #include <stdio.h> #include <pthread.h> #include <limits.h> #define UNUSED __attribute__((unused)) /* Global variables declarations */ int total_nodes_num, start_node, end_node, nodes_per_thread, total_threads, passed_nodes_num; /* Variables indicating the current/next node and the next minimal d...
C
#include <errno.h> #include <fcntl.h> #include <semaphore.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/wait.h> #include <time.h> #include <unistd.h> #define NUMBER_OF_RECORDS 100 #define SHM_FILE_NAME "/ex17_shm_file_nam...
C
#include <stdio.h> #include "mpi.h" int main(int argc,char *argv[]){ int size, rank, dest, source, count, namelen, tag=1; int inmsg, outmsg=0; MPI_Status Stat; char mc_name[MPI_MAX_PROCESSOR_NAME]; MPI_Init(NULL, NULL); MPI_Comm_size(MPI_COMM_WORLD, &size); M...
C
#ifndef _OPCOES_H_ int selecionarCorManualmente(){ system("cd funcionalidades&start selecionarCor.exe"); FILE *fpcor; int cod = 1; while((fpcor = fopen("funcionalidades\\selecionarCor.dat","rb"))==NULL) _sleep(1000); fread(&cod,sizeof(cod),1,fpcor); fclose(fpcor); _sleep(2000); ...
C
#ifndef _NODE_H_ #define _NODE_H_ #include "leaf.h" #include "index.h" struct Node { /* * @brief constructor of node * @param is_leaf leaf node or not */ explicit Node(bool is_leaf, size_t record_max_size); /* * @brief get the size of data * @return size of data */ size_t...
C
#include<stdio.h> #include<math.h> int main() { long int n,dia,i=1; while(scanf("%ld",&n)==1) { if(n==0)break; dia=ceil((3+sqrt(9+(8*n)))/2); printf("Case %ld: %ld\n",i++,dia); } return 0; }
C
#include <avr/io.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <util/delay.h> #include <avr/sfr_defs.h> #include <math.h> #include <avr/interrupt.h> #include <avr/eeprom.h> #ifndef _BV #define _BV(bit) (1<<(bit)) #endif #ifndef sbi #define sbi(reg,bit) reg |= (_BV(bit)) #e...
C
// // Created by YaNan on 2018/4/26. // #include <stab.h> //count characters in input;2 nd version double main() { double nc; for (nc = 0; getchar() != '\n'; ++nc); printf("%.0f\n", nc); }
C
/*This is program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz */ #include <stdio.h> int main(void) { int i; for (i=1; i<=100; i++) { if (i%15 == 0) printf ("FizzBuzz\n"...
C
//Based on https://github.com/sublee/squirrel3-python/blob/master/squirrel3.py #ifndef _SQUIRREL3_H_ #define _SQUIRREL3_H_ struct Squirrel3Random { static int generate(const int value, const int seed = 0) { /*Returns an unsigned integer containing 32 reasonably-well-scrambled bits, based on a ...
C
/* Выделить под массив динамически память. Обращаться к элементам массива необходимо используя указатель. 1. В одномерном массиве, состоящем из n вещественных элементов, вычислить: - сумму отрицательных элементов массива; - произведение элементов массива, расположенных между максимальным и минимальным элементами */ ...
C
/* 1. Você foi contratado por uma empresa de contabilidade e a sua primeira tarefa é fazer um programa que resolva a seguinte situação. Suponha que os brasileiros consomem arroz por região, queremos saber a media ponderada de consumo de arroz por região no Brasil, na região norte eles consomem 100 kilos de arro...
C
#include "smooth_line.h" void smooth_line_init(smooth_line *p, int initialValue) { int i; for (i = 0; i < SMOOTH_LINE_SMOOTHNESS; i++) { p->members[i] = initialValue; } } int smooth_line_put(smooth_line *p, int value) { int i; for (i = 0; i < SMOOTH_LINE_SMOOTHNESS - 1; i++) { ...
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 "string.h" #include "NUC1xx.h" #include "SYS.h" #include "SPI.h" #include "GPIO.h" #include "LCD.h" #include "Font5x7.h" #include "Font8x16.h" extern SPI_T * SPI_PORT[4]={SPI0, SPI1, SPI2, SPI3}; char DisplayBuffer[128*8]; void init_SPI3(void) { DrvGPIO_InitFunction(E_FUNC_SPI3); /* Co...
C
/* FORCES - Fast interior point code generation for multistage problems. Copyright (C) 2011-14 Alexander Domahidi [domahidi@control.ee.ethz.ch], Automatic Control Laboratory, ETH Zurich. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as publish...
C
#define _CRT_SECURE_NO_WARNINGS 1 include<stdio.h> int main() { int i; for (i = 1; i <= 100; i++) { if (i % 2 != 0) { printf("%d ", i); } } return 0; }
C
#include "Normalization.h" /* normalizeMatrix * Desc. : Function to shift elements in the array from 0 to 255 to -128 to 127 * * Input * inputMatrix : Input 2D array/matrix. * */ void normalizeMatrix(int size, float inputMatrix[][size]){ int i, j; for(i = 0; i < size; i++){ for(j = 0; j < size; j++){...
C
#include "../inc/header.h" int main(int argc, char *argv[]) { if (argc != 2) { mx_printerr("usage: ./read_file [file_path]\n"); return 0; } int fd = open(argv[1], O_RDONLY); if (fd < 0) { mx_printerr("error\n"); return 0; } char c; while(read(fd, &c, 1) > 0) write(1, &c, 1); if (close(fd) < 0) { ...
C
#include <sys/types.h> #include <sys/socket.h> #include <sys/un.h> #include <stdio.h> #include <stdlib.h> #define NAME "socket" main(){ int client_socket; int a; int len; struct sockaddr_un to; char message[] = "This is message from the client"; // socket create client_socket = socket(PF_UNIX, SOCK_DGRAM, 0); ...
C
#include <stdio.h> #include <locale.h> int fatorial(int); int main (void) { setlocale(LC_ALL,""); int numero; printf("\t\t<<<<<PROGAMA QUE RESOLVE UM FATORIAL DE UM NMERO>>>>>"); printf("\nInsira o valor de um nmero a ser fatorado: "); scanf("%d", &numero); printf("\nFatorial: %d", fatoria...
C
#include<iostream> using namespace std; int main() { int age; cout<<"Enter age:"; cin>>age; if(age>=18) cout<<"\nYou are eligible for voting"; else cout<<"\nYou are not eligible for voting"; return 0; }
C
/* File: seqconvert.c * Author: Richard Durbin (rd109@cam.ac.uk) * Copyright (C) Richard Durbin, Cambridge University, 2019 *------------------------------------------------------------------- * Description: utility to convert between sequence formats * Exported functions: * HISTORY: * Last edited: Jun 20 13:...
C
#include "push_swap.h" t_llist *make_list(t_arg *arg) { t_llist *list; t_node *node; list = init_list('a'); list->size = 0; while (arg) { append(list, ft_atoi(arg->str)); arg = arg->next; } return (list); } void add_node(t_llist *list, int value) { t_node *new_node; t_node *node; new_node = m...
C
#include <stdio.h> #include <sys/types.h> #include <time.h> #include <unistd.h> int main() { pid_t pid = fork(); if (pid == 0) { //in child process // char cwd[100]; // if(getcwd(cwd, sizeof(cwd)) != NULL) // printf("Current working dir: %s\n", cwd); char * arg[] = {...
C
/* ** my_new_env.c for 42sh in /home/gicque_p/rendu/PSU_2013_42sh/source/my_env ** ** Made by Pierrick Gicquelais ** Login <gicque_p@epitech.net> ** ** Started on Mon May 12 10:11:23 2014 Pierrick Gicquelais ** Last update Sun May 18 22:24:23 2014 Antoine Plaskowski */ #include <stdlib.h> #include "my_env.h" #inc...
C
// // 直接插入排序 // // 思想:假设第一位为排好的数组,从数组中的第二位开始, // 找到合适的位置并直接插入之前排好序的数组中 // // 2019.6.20 czw // #include <stdio.h> // // 功能:直接插入排序 // 参数: // a,待排序的数据 // n,数组的个数 // void straightInsertionSort(int a[],int n) { // for(int i = 1; i <= n; i++) { // int j = i - 1; // int tmp = 0; // ...
C
#include "nn.h" #define printf(...) /* Assigns a = b. */ void NN_Assign (a, b, digits) NN_DIGIT *a, *b; unsigned int digits; { if(digits) { do { *a++ = *b++; }while(--digits); } } /* Returns sign of a - b. */ int NN_Cmp (a, b, digits) NN_DIGIT *a, *b; unsigned int digits; { if(digits) { do { digit...
C
#include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <inttypes.h> #include <time.h> #include <string.h> #include "counterMode.h" #include "signatureGAMAL.h" #include "User.h" #include "FileCipherWithDES.h" #include "ElgamalSignature.h" extern User user; void managementKeys(){ system("clear"); List list...
C
#include "prelude.h" double G1(double x){ // 0, 1 return sqrt(12)*(x-0.5); } double G2(double x){ // 0, 1 if(x>0){ return -log(x)-1; } else return NAN; } double G3(double x){ // 0, 1 if(x<0) return NAN; double a; if(x<0.5){ a = 2*sqrt(2*x); } ...
C
#include <stdio.h> #include <err.h> #include <fcntl.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <inttypes.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> #include <time.h> int main(int argc, char* argv[]) { // argv[1]=record/replay argv[2]=file i...
C
//Please add a comment to each lines that has changes and Indicate the changes #include<stdio.h>// changed to ,stdio.h> char main() { char a,b,c; int mx,mi;// changed mx and mi to integers scanf("%d%d%d",&a,&b,&c);// changed %f to %d printf("\t%s\t%s\t%s",a,b,c); if(a>b) { if(a>c) { mx=a; if(b>c) mi...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_printf_converter_hex.c :+: :+: :+: ...
C
/* * File: structPerso.h * Author: tom * * Created on 1 août 2015, 11:46 */ #ifndef STRUCTPERSO_H #define STRUCTPERSO_H #define TAILLE_SAC 10 #define TAILLE_EQUIP 7 // 1 casque, 1 armure, 1 bottes, 1 collier, 2 anneaux, // 1 arme, 1 carquois struct Objet{ int codeObjet; int modificateur; int est...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <limits.h> #include <ctype.h> #include <stdint.h> #define MAXLINELENGTH 1000 typedef union { struct { int32_t offset: 16; uint32_t regB: 3; uint32_t regA: 3; uint32_t opcode: 3; uint32_t empty: 7; } fie...
C
/* 计算字符串的长度 */ int str_len(const char s[]) { int i = 0; /* 下面的while循环的判断条件不能使用s[i++]!='\0',因为当i==4时,尽管 * s[i++]!='\0'为假,跳出while循环,但是i++还是执行了一次,跳出循环后, * i == 5,即i被多加了一次(假设传进来的字符串是 "tian"). */ while (s[i] != '\0') ++i; /* 因为数组下标是从 0 开始数,所以字符串长度会比数组下标多 1,当 * s[i] == '\0'时,数组下标刚好多加了一次,所以下面直接返回 i 是正确的. */ r...
C
#include <stdio.h> int l[300]; int tt(int s1, int e1, int s2, int e2, int limit) { int f[300]; memset(f, 0, sizeof(f)); int i, j, m; for (i = s1; i <= e1; i++) { if (l[i] >= limit) continue; m = 0; for (j = e2; j >= s2; j--) { if (l[j] >= limit) continue; if (l[i] == l[j]) { if (f[m] + 1 > f[j]) ...
C
/* * Roman Hargrave, ***REMOVED*** * No License Declared * * Provides mathematics and array applications specific to the grading process */ #ifndef _H_GRADING #define _H_GRADING #include "models/models.h" // Begin Header "grading.h" ----------------------------------------------------------------------...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/capability.h> #include <signal.h> #include "../common.h" uid_t saved_ruid; static void boing(int sig) { printf("*(boing!)*\n"); } static void usage(char **argv, int stat) { fprintf(stderr, "Usage: %s 1|2\n" ...
C
#include <stdio.h> int main(int argc, char *argv[]) { int nums[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int *cur_num = nums; int len_nums = sizeof(nums) / sizeof(int); for(int i=0; i<len_nums; i++) { printf("\nums[] lives at %p\n", &nums); printf("*cur_num lives at %p\n", &*cur_num); ...
C
/* Window֌W */ #include "bootpack.h" void make_window8(unsigned char *buf, int xsize, int ysize, char *title, int icon, char act) { boxfill8(buf, xsize, COL8_C6C6C6, 0 , 0 , xsize-2, 0 ); // 㔖DF boxfill8(buf, xsize, COL8_C6C6C6, 0 , 0 , 0, ysize-2); // DF boxfill8(buf, xsize,...
C
#include<stdio.h> #include<error.h> #include<dirent.h> int main(int argc,char *argv[]) { DIR *dp; struct dirent *dirp; dp=opendir(argv[1]); dirp=readdir(dp); while(dirp!=NULL) printf("%s\n",dirp->d_name); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* json_validate_polygon.c :+: :+: :+: ...
C
void my_putnbr_base_ld(long int nb, char *base) { long int resultat; long int div; int t_base; t_base = my_strlen(base); if (nb < 0) { my_putchar('-'); nb = -nb; } div = 1; while ((nb / div) >= t_base) div = div * t_base; while (div > 0) { resultat =...
C
#include <limits.h> #include "CUnit/Basic.h" #include "l_stack.h" #include "l_stackTest.h" void linn_testPushAndPopOneInteger() { // ARRANGE int expectedValue = 123; l_Stack *stack = createStack(); // ACT push(expectedValue, stack); int actualValue = peek(stack); // ASSERT CU_ASSERT_E...
C
/** * \file Reader for NIfTI-1 format files. */ #include <internal_volume_io.h> #include <volume_io/basic.h> #include <volume_io/volume.h> /** * Initializes loading a NIfTI-1 format file by reading the header. * This function assumes that volume->filename has been assigned. * * \param filename The filename to o...
C
#include<stdio.h> void main() { int i,j; for(i=1;i<6;i++) {for(j=0;j<i;j++) {if(i%2!=0) { printf("%d ",1+(2*j)); } else printf("%d ",2+(2*j)); }printf("\n"); } }
C
#include <bits/stdc++.h> using namespace std; int main(){ int vertex,origin,dest,choice; char type; cout<<"Type 'U' for undirected graph and 'D' for directed graph "; cin>>type; cout<<endl; cout<<"Enter no of vertices "; cin>>vertex; cout<<endl; int count=0,adjmat[vertex][vertex]; if(count==0) { for(int i=...
C
#include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <stdio.h> #include<readline/readline.h> #import<readline/history.h> #include <string.h> #include <stdlib.h> #include <dirent.h> #include <errno.h> #include <unistd.h> #include <ctype.h> const int max_history_size = 5; char *history[max_history...
C
#include <stdio.h> #include <math.h> #include <stdlib.h> #include "radical.h" #include "struct.h" int main (int argc, char *argv[]) { if (argc < 4) { printf ("Input a, b, c : (ax^2 + bx + c)\n"); return EXIT_FAILURE; } int flg = 0; radix *data; data = (radix *) malloc(sizeof(rad...
C
#include <stdio.h> #include "strlib.h" void check_compare (char* a, char* b) { if (!my_strcmp (a, b)) { printf ("Strings match!\n"); } else { printf ("Strings DON'T match!\n"); } } int main (int argc, char** argv) { char foo[] = "Foo"; char empty[] = ""; char str1[] = "ECE Programmers are the best!"; char ...
C
/* ** EPITECH PROJECT, 2019 ** objdump ** File description: ** header.c */ #include "objdump.h" int get_flags(elf_t *elf) { int flags = 0; switch(elf->ehdr->e_type) { case 1: printf("HAS_RELOC, "); flags++; break; case 2: printf("EXEC_P, "); flags++; break; case 3: printf("HAS_SYMS, D...
C
#pragma once enum class Direction { Up = 0b00, Down = 0b01, Right = 0b10, Left = 0b11 }; bool IsOpposite(Direction a, Direction b);
C
/* HCS Week 6 Lecture 1 Example 8 Pointers */ #include <stdio.h> int main(void) { int nA; // Declare an integer int *ptrPoint; // Declare a pointer to an integer nA = 42; // Assign a value to nA ptrPoint = &nA; // Assign the address of nA to the pointer printf("Directly. nA has the value %d\n", nA...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <sys/types.h> #include <sys/socket.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <aio.h> #include <signal.h> #include <sys/time.h> //#include <pthread.h> //#include <sys/syscall.h> #define BACKLOG 6 #def...
C
/** * This file implements: * simple_path, * This file cannot run with the math.h header file */ // This function creates the simple "bump" trajectory in 2D // cur_pos is our aircraft's position (only longitude and altitude are used) // target_pos is point we want our aircraft to pass through // finalYPos is the a...
C
/*********************************************** * Name: Peigeng Han * Student ID: 20533982 * File: rational.c * CS 136 Fall 2014 - Assignment 3, Problem 3 * Description: Working with rational numbers. ***********************************************/ #include "Cs136-A3Q3-rational.h" // see rational.h struct ra...
C
#include "control.h" #include <unistd.h> //para hacer el sleep #define NUM_AVIONES 200 //estructura para identificar el avión, con su numero //y con un puntero al monitor control typedef struct { //identificador del avión int num_avion; //puntero a las pistas pistas_t *pistas; }aviones_t; //código d...
C
#include "server.h" static void user_struct_filling_with_null(t_user *User) { User->id = NULL; User->nickname = NULL; User->password = NULL; User->email = NULL; User->age = NULL; User->fullname = NULL; User->ph_number = NULL; User->user_photo = NULL; User->option = NULL; User->n...
C
//zad3b #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #define FIFO1 "/tmp/fifozad2" main() { char buff[512]; int fifo,i=0; if ((fifo = open(FIFO1, O_RDONLY, O_NDELAY )) < 0) perror("nie moze otworzyc fifo1 do pisania"); int bytes = read(fifo,buff,sizeof(buff)); while (i < ...
C
#include<stdio.h> #include<unistd.h> #include<sys/types.h> int main(){ int n = 10; int id = vfork(); if(id == 0){ printf("child process started \n"); printf("value of n = %d\n",n); }else{ printf("Now I am coming back is parent process \n"); printf("value of n = %d\n",n); ...
C
typedef struct { char **words; int nr_words; } MagicDictionary; /** Initialize your data structure here. */ MagicDictionary* magicDictionaryCreate() { return (MagicDictionary *)malloc(sizeof(MagicDictionary)); } /** Build a dictionary through a list of words */ void magicDictionaryBuildDict(MagicDictiona...
C
#include "garbage.h" void gfree(t_garbage *gc) { size_t i; i = 0; while (i < gc->head) { free(gc->ptr_tab[i]); i++; } free(gc->ptr_tab); gc->head = 0; gc->ptr_tab = NULL; }
C
/* * @Description: 奇偶分离 * @Author: cheny * @Date: 2020-01-04 12:55:03 * @LastEditor: cheny * @LastEditTime : 2020-01-04 13:01:11 * @FilePath: \C_code\TestCode\C.CPP\Practicing\11_oddAndEvenNumSeparate.c */ #include <stdio.h> void oddEvenSeparate(int n){ for(int i = 1; i <= n; ++i){ if(i % 2 == 0){ ...
C
#include<arpa/inet.h> #include<netinet/in.h> #include<stdio.h> #include<sys/types.h> #include<unistd.h> #include<ctype.h> #include<stdlib.h> #include<string.h> #include<netdb.h> int main(int argc,char* argv[]){ struct sockaddr_in serverAddr; int socketfd; if(argc<2){ return 0; } int portno=atoi(argv[1]); so...
C
#include<stdio.h> #include<conio.h> void main () { int x; clrscr(); printf("\nenter your number:"); scanf("%d",&x); printf("your hexa number=%x",x); getch(); }
C
#ifndef HEAP_H #define HEAP_H #include <stdint.h> #include <stddef.h> struct node_t { int32_t key; void* value; }; struct heap_t { struct node_t* data; size_t capacity; size_t size; }; void make_heap(struct heap_t*, size_t); void heapify(struct heap_t*, int32_t); void insert(struct heap_t*, in...
C
#include <msp430.h> /* * ClockSetup430G.c * Serves similar purpose to code previously written for MSP430FR5969, * counts up until overflow, then toggles a pin high/low. * * Created on: Mar 24, 2015 * Author: Sebastian A Roe */ int main(void) { // Stop watchdog timer WDTCTL = WDTPW | WDTHOLD; //Initia...
C
#include "decoder.h" void decoder(ADH_arbreDeHuffman arbre,FichierBinaire source, FichierBinaire* dest,int longueur,CLC_FonctionCopier copierBit,CLC_FonctionLiberer libererBit){ unsigned long long bit_restants=longueur; octet o; CodeBinaire cTemp,code=CB_creerCodeBinaireVide(); while (!(FB_finFichier(source)...
C
//1005번 /* 그래프 그리는거까진 하겠는데 그다음부터 아예 못풀겠다. */ #include <stdio.h> int adjMat[1001][1001]={0}; int DFS(int target,int N, int time[],int DP[]){ int max=0,result=0; int i,answer; if(DP[target]!=0){ return DP[target]; } for(i=1;i<=N;i++){ if(adjMat[i][target]==1){ resul...
C
/* * */ #include <seahorn/seahorn.h> #include <aws/common/byte_buf.h> #include <byte_buf_helper.h> #include <utils.h> int main() { /* data structure */ struct aws_byte_cursor cursor; initialize_byte_cursor(&cursor); size_t len = nd_size_t(); /* assumptions */ assume(aws_byte_cursor_is_valid...
C
/* * Copyright 2016-2021 Chiz Chikwendu * */ /** * @file smartpooltmr.c * @brief glue code for interface with spi, i2c and gpio * */ /*---------------------------------------------------------------------------*/ /* Includes*/ /*---------------------------------------------------------------------------*/ #incl...
C
#include <stdio.h> #include <stdlib.h> typedef struct Node { int data; struct Node* next; struct Node* prev; } Node; typedef struct LinkedList { int data; struct LinkedList* next; } LinkedList; struct Node* head = NULL; struct Node* current = NULL; int isEmpty() { } LinkedList* create(int n)...
C
#ifndef _ANT32_VM_H_ #define _ANT32_VM_H_ /* $Id: ant32_vm.h,v 1.4 2002/01/02 02:29:18 ellard Exp $ * * Copyright 1996-2001 by the President and Fellows of Harvard College. * See LICENSE.txt for license information. * * Dan Ellard -- 08/04/99 * * ant32_vm.h -- header file for the ANT VM. */ typedef struct { ...
C
#include <stdio.h> struct my_data { int a; char c; float arr[2]; }; int main_07_1() { //struct my_data d1 = { 1234, 'A', {1.1f, 2.2f} }; struct my_data d1 = { 1234, 'A', }; d1.arr[0] = 1.1f; d1.arr[1] = 2.2f; printf("%d %c %lld\n", d1.a, d1.c, (long long)d1.arr); printf("%f %f\n", d1.arr[0]...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <SDL/SDL.h> #include <SDL/SDL_image.h> void BufRev(unsigned char *p) { unsigned char *q = p; while(q && *q) ++q; for(--q; p < q; ++p, --q) *p = *p ^ *q, *q = *p ^ *q, *p = *p ^ *q; } void Filter(unsigned char * pixels, int width...
C
/* Program to test calling the 'system' function Gilberto Echeverria 30/08/2018 */ #include <stdio.h> #include <stdlib.h> int main() { printf("In the main program\n"); system("ls -l .."); system("date +%H:%M"); system("python3 ../python_test.py"); printf("Returning to my main\n"); ...
C
#include<stdio.h> #include<sys/types.h> #include<stdlib.h> #include<sys/stat.h> #include<unistd.h> #include<fcntl.h> struct stat a; int sy; off_t file1,file2; char b1,c1; char buff[1001]; char buff1[1001]; off_t i,j; int main(int argc,char *argv[]){ char str[7]="sylink"; int fd,fd1,fd2,div=0,rem=0,k; fd=open("./As...
C
// // CFDictionaryAddition.c // iOSConsole // // Created by Sam Marshall on 1/4/14. // Copyright (c) 2014 Sam Marshall. All rights reserved. // #ifndef iOSConsole_CFDictionaryAddition_c #define iOSConsole_CFDictionaryAddition_c #include "CFDictionaryAddition.h" #include "Pointer.h" #include "Logging.h" #include "...
C
/* * @ file : time.h * brief : */ #include <time.h> // Is this year Leap year ? #define isLeapYear(x) (\ (\ ( (x) % 4 == 0 ) && \ ( (x) % 100 != 0 ) \ )|| \ ( (x) % 400 == 0 ) \ ) typedef struct time_zone{ time_t t; struct tm *tm; struct tm *pre_tm; // current time u_short ...
C
#include <stdio.h> #include <string.h> #include <ctype.h> #include "exerciceiv.h" void init_string(str string) { char c; int i = 0; while (c = getchar(), c != '\n' && c != EOF && i < DIM - 1) { *string++ = c; i++; } *string = '\0'; } int contains(str string, str sub) { while (...
C
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include"MailList.h" struct MailList g_allMSG[1000]; int g_count; int menu() { int tmp, ret; printf("1.ϵϢ\n" "2.ɾָϵϢ\n" "3.ָϵϢ\n" "4.޸ָϵϢ\n" "5.ʾϵϢ\n" "6.ϵϢ\n" "ѡ: "); ret = scanf("%d", &tmp); return ret ? tmp : -1; } void MailList() { int op; while...
C
#include "bootcamp.h" /** * print_square - prints size x size square * @size: dimensions of square * * Return: void */ void print_square(int size) { int i, size2; if (size < 1) _putchar('\n'); for (size2 = size; size2 > 0; size2--) { for (i = size; i > 0; i--) { _putchar('#'); } _putchar('\n'); ...
C
#include "attack_process.h" #include "io.h" void set_base_valor(char** arg_list, char* loic_path, char* ip){ arg_list[0] = loic_path; arg_list[1] = ip; arg_list[2] = "--syn"; arg_list[3] = "-p"; arg_list[4] = "80"; arg_list[5] = NULL; arg_list[6] = NULL; } void set_baseline( char**...
C
/* Author: lmborba */ #include <stdio.h> #include <stdlib.h> int pancakes[31]; int pancakes2[31]; int n; void preenche(char * a) { int i; n = 0; i = 0; while (a[i] != '\n') { if ((a[i] >= 48) && (a[i]<=57)) { pancakes[n] = a[i] - 48; i++; while ((a[i] >= 48) && (a[i]<=57)) { pancakes[n]...
C
void printdec(int val) { int temp, thresh, zeroflag; zeroflag = 0; thresh = 1000000000; if (val < 0) { val = -val; putchar('-'); } while (thresh > 1) { if (val >= thresh) { temp = val / thresh; putchar('0' + temp); val =...
C
#include<stdio.h> void array(int a[5]); void array(int x[5]) { for(int i=0; i<5; i++) { printf("%d",x[i]); } } int main() { int a[5]={1,2,3,4,5}; array(a); return 0; }
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 "main.h" unsigned char data[528]; int init(void) { // let the power stabilize delay_ms(250); spi_init(); flash_init(); DDRD = 0xFF; PORTD = 0xFF; return 0; } int main(void) { int i, flag; unsigned char c; init(); // writing all possible combo's to data[] c = 0x00; for( i = 0 ; i < 528 ;...