language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <dirent.h>
#include <string.h>
#include <sys/stat.h>
void list_directory( char *dir_path, int f_flag, int r_flag);
void listAll(char *dir_path, int f_flag);
int main( int argc, char **argv) {
int c, f_flag = 0, r_flag = 0;
int i... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* page_type.c :+: :+: :+: ... |
C | #include <stdio.h>
/*
NAMA : Rizki Ramadhani
NIM : 160801087
JUDUL : Tipe Array
*/
int main(void)
{
int bilangan[5];
bilangan[0] = 6;
bilangan[1] = 9;
bilangan[2] = -8;
bilangan[3] = 24;
bilangan[4] = -99;
printf("Isi array bilangan pertama: %d \n",bilangan[0]);
printf("I... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main (int argc, char *argv[]) {
char *arguments[]={"expr", "1", "+", "2", NULL};
char *environnement[]={"LANG=fr",NULL};
printf("Exécution du processus %d\n",getpid());
printf("Exécution de /usr/bin/expr\n");
int err=execve("/usr/bin/expr", ar... |
C | # include <stdio.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <dirent.h>
# include <stdlib.h>
ino_t get_inode( char * );
void printpathto( ino_t );
void inum_to_name( ino_t, char *, int );
int main()
{
printpathto(get_inode("."));
putchar('\n');
return 0;
}
void printpathto( ino_t this_ino... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int x, division=2;
printf("Enter the number\n:");
scanf("%d",&x);
if(2<=x)
{
printf("%d=",x);
while(x>1)
{
if(x%division == 0)
{
printf("%d ",division);
x/=... |
C | #include <stdlib.h>
#include "crc.h"
unsigned long int my_hash(char* str,size_t len){
unsigned long int result = 0;
for ( int i = 0; i < len; i++){
result += str[i] * ( str[i] << (i % 4)) + str[i];
result += result * result << 6 ;
}
return result;
} |
C | #include "apue.h"
#include <pthread.h>
/*
* 线程返回退出状态的两种方式 return 和 pthread_exit()
*/
void *thr_fn1(void * arg)
{
printf("thread 1 returning\n");
return ((void *) 10);
}
void * thr_fn2(void* arg)
{
printf("thread 2 exit\n");
pthread_exit((void *) 99);
}
int main()
{
int err;
pthread_t t... |
C | #include <stdio.h>
int main(){
int p, i, proc, clock;
char linha[51];
while(scanf("%[^\n]%*c",&linha) != EOF){
scanf("%d%*c",&p);
proc = clock = 0;
for(i = 0; linha[i] != '\0'; i++){
if(linha[i] == 'W'){
clock++;
if(proc > 0){
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
//minimize the absolute difference
// minimize(max(A[i],B[j],C[k])-min(A[i],B[j],C[k]))
//complexity : O(n1+n2+n3);
int findMin(int n1,int n2,int n3,int *x)
{
if((n1<=n2) && (n1<=n3))
{
*x=1;
return n1;
}
else... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
int player[5]= {10, 20, 30, 40, 50};
int goals[5]= {30, 21, 43, 26, 41};
int games[5]= {30,29,29,30,27};
float ppg[5];
float bestppg=0.0;
int bestplayer;
for (i=0; i<=4; i++){
ppg[i] = (float)goals[i]/(float)games[i... |
C | /****************************************************************************
* author: *
* Jonas Jansen *
* *
* d... |
C | #include <stdio.h>
#include <string.h>
int main () {
int n;
scanf("%d", &n);
char str[n][64];
int i, j;
for (i = 0; i < n; i++) {
scanf("%s", &str[i]);
}
int roll;
scanf("%d", &roll);
char temp[64];
for (i = 0; i < roll; i++) {
// Tampung elemen yang pertama
strcpy(temp, str[0]);... |
C | /*
* =====================================================================================
*
* Filename: task3.c
*
* Description: Create a multiplication table 1 - 10 with for loops.
*
* Version: 1.0
* Created: 02/08/2018 08:52:08 AM
* Revision: none
* Compiler: gcc
*... |
C | /*
* these two functions are ripped off from confuse.c ....
* for some reason there's no public function to add a
* section to the in-memory config
* ...
*/
#define _GNU_SOURCE
#include <string.h>
#include <malloc.h>
#include <confuse.h>
static cfg_opt_t *cfg_dupopts(cfg_opt_t *opts)
{
int n;
cfg_opt_t *dup... |
C | //
// main.c
// Inversions
//
// Created by fast-algo on 02/09/2018.
// Copyright © 2018 fast-algo. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <memory.h>
#include "funcTimer.h"
#define FILENAME "/Users/Shared/Data/IntegerArray.txt"
int loadData(int **data);
long int... |
C | /* Interface to hashtable implementations.
Copyright (C) 2006-2022 Free Software Foundation, Inc.
This file is part of libctf.
libctf 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
Software Foundation; either version... |
C | #include "main.h"
int insert_at_first(slist **head, data_t data)
{
//Create node
slist *new = malloc(sizeof(slist));
//Validation
if (new == NULL)
{
return FAILURE;
}
new->data = data;
new->link = *head;
*head = new;
return SUCCESS;
}
|
C | #include <stdint.h>
#include <stdbool.h>
#include <ctype.h>
#include <string.h>
#include "str2n.h" // MACROS
#include "macros.h" // is?digit()
//+===========================================================================
// str2d - convert string to dword {Bin, Oct, Dec, Hex}
//
// Binary: 10b
// Octal: 1234... |
C | #include <stdio.h>
#include <stdbool.h>
#include "fact.h"
#include "prime.h"
#include "swap.h"
int main(int argc, char const *argv[]) {
unsigned int n;
do {
printf("Give me a number [0-20]: ");
scanf("%u", &n);
} while (n > 20);
printf("fact of %u = %llu\n", n, fact((unsigned char)n));
printf("%u... |
C | #define START_BALLZ 5
#define MAX_BALLZ 20
#define BALL_SIZE 80
#define HALF_SIZE 40
#define BIG_SIZE 220
/**
* Tipo que representa a bola do jogo
*/
typedef struct ball {
int x, y, sindex, size;
bool released, picked;
double opacity;
} BALL;
/**
* Tipo que representa as bolas geradas no cenário
*/
typede... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct node *Nodeptr;
struct node{
int data;
Nodeptr left;
Nodeptr right;
};
Nodeptr getnode(){
Nodeptr temp = (Nodeptr)malloc(sizeof(struct node));
return temp;
}
typedef struct
{
Nodeptr queue[20];
int front;
int rear;
}QUEUE;
void insert(QUEUE *ptr, Nodeptr ... |
C | /*
Copyright (c) 2005-2008, Simon Howard
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL ... |
C | #include <stdio.h>
#include <locale.h>
int main()
{
setlocale(0,"Russian");
int N, k=1;
printf("Array size(N>0): ");
scanf("%d", &N);
int array[N];
for (int i=0; i<N; i++){
array[i]=k;
k+=2;
}
for (int i=0; i<N; i++){
printf("%d ", array[i]);
}
return 0... |
C | #include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
void *helper(void* arg) {
printf("Hello World! 1\n");
pthread_exit(0);
}
int main() {
pthread_t thread;
pthread_create(&thread, NULL, &helper, NULL);
/* pthread_join(thread, NULL); */
printf("Hello World! 2\n");
exit(0);
}
|
C | #include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdbool.h>
#include <pthread.h>
#include <semaphore.h>
#include <signal.h>
#define KGRN "\x1B[32m"
#define KRED "\x1B[31m"
#define KWHT "\x1B[37m"
#define MSG_REQUEST 1 //request ... |
C | #include<stdio.h>
#include<conio.h>
#include<locale.h>
#include<string.h>
#include<stdlib.h>
struct info1
{
char pat[7];
int rut;
int paqm;
float capm;
};
int validadato(int,int,int);
void main()
{
setlocale(LC_CTYPE,"Spanish");
struct info1 aux;
int i,rut,paqm;
float capm;
... |
C | #include <stdio.h>
#include <stdlib.h>
#define MAX 201000
typedef struct edge_def {
struct node_def *u;
struct node_def *v;
int cost;
} edge;
typedef struct node_def {
int vertex;
struct node_def *parent;
int rank;
} node;
edge *edge_heap[MAX + 1];
node *nodes[MAX];
int nv, ne;
int last;
... |
C | #ifndef __SERVEUR_H__
#define __SERVEUR_H__
/** \file serveur.h
* \brief This file provides BEEP server functions
* This file provides some usual functions for a server like init, reception and emission.
* It also contains some other derivated functions to test and play with received requests
* plus response makin... |
C | /**************************************************************************//**
* @file
* @brief This example toggles between the VS2 and VS1 voltage scaling
* levels in EM0. When observed using Simplicity Studio's Energy
* Profiler, the power savings achieved by running at a DECOUPLE
* voltage of 1.1V (VS2) vs. ... |
C | /* * * * * * *
* Module for creating and manipulating queues of integers
*
* created for COMP20007 Design of Algorithms 2017
*
*/
#include <stdbool.h>
#include "list.h"
// create a new queue and return a pointer to it
List* new_queue();
// destroy a queue and free its memory
void free_queue(List* list);
//... |
C | /*
* Copyright (c) 2003, Intel Corporation. All rights reserved.
* Created by: salwan.searty REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
This program verifies that sigpause()... |
C | #include <stdio.h>
int main()
{
int temp, sum=0, i, number;
printf("\n \t Enter the number =");
scanf("%d",&number);
for(i=0; 0<number;i++)
{
temp=number%10;
number =number/10;
sum=sum+temp;
}
printf("\n \t Sum of digits = %d",sum);
printf("\n\t Enjoy The Proggramming With Me ");
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
struct record{
char name[12];
int age;
};
int main(int argc, char *argv[])
{
struct record array[2];
FILE *fp = fopen("recfile", "r");
if(fp == NULL){
perror("open file");
exit(1);
}
fread(array, sizeof(struct record), 2, fp);
printf("read name:%s, age:%d\n", array[... |
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 "header.h"
int bubblesort (int *array, int size) {
int i;
int j;
int temp;
for (i = 0; i < size; i++) {
for (j = i + 1; j < size; j++) {
temp = *(array + i);
*(array + i) = *(array + j);
*(array + j) = temp;
}
}
return *array;
}
|
C | #include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "stm32f30x_gpio.h"
#include "stm32f30x_usart.h"
void usart2_init() {
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOD, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
// Datasheet -> Alternate functions for port D -> PD5
GPIO_PinAFConfig... |
C | //
// main.c
// lab_4_problem_1
//
// Created by Chris Miller on 7/8/18.
// Copyright © 2018 Chris Miller. All rights reserved.
//
#include <stdio.h>
#define SIZE 3
void change(int * const array, const size_t size);
void printArray(int * const array, const size_t size);
int main(int argc, const char * argv[]) {
... |
C | //--------------------------------------------------------------------------
// Name: web_proxy.c
// Author: Adam Smrekar
// Date: November 22, 2019
// Description: HTTP-based GET web proxy that handles multiple
// simulatanous requests from users.
// Note: Some of this code is referenced f... |
C | #ifndef RT_SPHERE
#define RT_SPHERE
#include "hittable.h"
struct sphere : public hittable
{
sphere() {}
sphere(point3 _center, double _radius, shared_ptr<material> _material) : center(_center), radius(_radius), material(_material) { }
point3 center;
double radius;
shared_ptr<material> material;
... |
C | #include <stdio.h>
int printnum(int );
int main()
{
long int n;
printf("enter the value of n\n");
scanf("%i",&n);
printnum(n);
return 0;
}
long int printnum(long int n)
{
return printnum(printf("%d ",n));
}
|
C | #include <unistd.h>
void print_bits(unsigned char octet) {
int i;
char c;
for (i = 7; i >= 0; i--) {
c = (octet & (1 << i)) ? '1' : '0';
write(1, &c, 1);
}
}
|
C | #include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int fd, copyfd;
fd = open("./log.txt", O_RDWR|O_CREAT);
copyfd = dup(fd);
char buf1[] = "hello ";
char buf2[] = "world!";
if (write(fd, buf1, 6) != 6) {
printf("write error!");
}
... |
C | #include <esc64asm/mempool.h>
#include <stdlib.h>
void MemPoolInit(MemPool* pool, size_t size, void* mem)
{
pool->begin = mem;
pool->end = mem + size;
pool->head = mem;
}
void MemPoolClear(MemPool* pool)
{
pool->head = pool->begin;
}
void* MemPoolAlloc(MemPool* pool, size_t size)
{
size_t freeSize = pool->end ... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
FILE *fp;
int time1, time2, hour, min, sec, diff;
char h1[3], m1[3], s1[3], h2[3], m2[3], s2[3];
fp = fopen(argv[1], "r");
while(fscanf(fp, "%2s:%2s:%2s %2s:%2s:%2s\n",
h1, m1, s1, h2, m2, s2) == 6)
{
time1 = atoi(h1)*3600 + atoi(m1)*... |
C | /* Upon finishing the first half of nand2tetris (and implementing the
* assembler for Project 6 in Python), I wanted to learn C to a basic level.
* After a little thought, I decided re-implementing the assembler in C would
* make for a decent milestone of basic competence and also give me something
* to focus on wh... |
C | #include<stdio.h>
#define ELEMENTI 4
#define CAPACITA 9
int zaino(const int *Capacity, const int *Weight, int *Profit, const int *n);
int max(int Value1, int Value2);
int main() {
int profit[] = {10, 7, 8, 6};
int weight[] = {4, 2, 3, 4};
int Capacita = CAPACITA;
int n = ELEMENTI;
printf("The ... |
C | #include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
int m=lcm(a,n);
printf("%d",m);
}
int lcm(int a[], int n)
{
// Initialize result
int ans = a[0];
// ans contains LCM of arr[0], ..arr[i]
// after i'th ite... |
C | #include <assert.h>
#include <string.h>
#include "map.h"
#include "aroma.h"
#include "army.h"
#define MIN_ARMY_SIZE 3
void enlist(point p) {
grid(army, p) = 0;
}
void promote(point p) {
if (map_has_friendly_ant(p)) {
grid(army, p) += 1;
}
}
void initial_inspection(point p) {
if (grid(army_ar... |
C | /*************************************************************************
> File Name: 2.96.blog.c
> Author: sukong
> Mail: sukong@outlook.com
> Created Time: 2016年04月19日 星期二 09时41分42秒
************************************************************************/
#include<stdio.h>
#include<types.h>
int fl... |
C | /*
** song.c for in /home/sabour_f/rendu/ircbot/AI/src
**
** Made by Florian SABOURIN
** Login <sabour_f@epitech.net>
**
** Started on Wed May 6 18:18:18 2015 Florian SABOURIN
** Last update Wed May 6 18:18:18 2015 Florian SABOURIN
*/
#include "database.h"
#include <stdlib.h>
#include <string.h>
t_song* song_fr... |
C | #include "binary_trees.h"
/**
* binary_tree_insert_left - insert node to left child of parent.
* @parent: parent node.
* @value: value of new node.
* Return: new node inserted to the left child.
*/
binary_tree_t *binary_tree_insert_left(binary_tree_t *parent, int value)
{
binary_tree_t *new, *search;
if (!paren... |
C | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <math.h>
int a2i(char *s);
int main(){
char * words = (char *) malloc(sizeof(char)*20);
printf("Enter: ");
scanf("%s", words);
int rtn = atoi(words);
... |
C | /* parallel_dot1.c -- Computes a parallel dot product. Uses MPI_Allreduce.
*
* Input:
* n: order of vectors
* x, y: the vectors
*
* Output:
* the dot product of x and y as computed by each process.
*
* Note: Arrays containing vectors are statically allocated. Assumes that
* n, the global ... |
C | #ifndef ls_h
#define ls_h
int ls(int x);
{
strcpy(str, "----------");
{
if(S_ISDIR(mode)) str[0] = 'd';//directory
if (S_ISCHR(mode)) str[0] = 'c';//character devices
if (S_ISBLK(mode)) str[0] = 'b';//block device
if (mode & S_IRUSR) str[1... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.c :+: :+: :+: ... |
C | #include "slots.h"
/*
* slot_board_vendor_info(kind, slot, string, size)
* int kind
* int slot;
* char *string;
* int size;
*
* Slot_board_vendor_info returns the requested vendor information
* string into "string." The request for "kind" is one of the vendor
* information list types (found in slots.h.) Siz... |
C | /*
** EPITECH PROJECT, 2020
** My Hunter
** File description:
** Windows related function
*/
#include "include/my.h"
char *get_name(char *filepath)
{
int index = get_last_point(filepath);
char *name = my_strncpy(filepath, index);
char **map2 = my_str_to_word_array_char(name, '/');
return (map2[2]);
}... |
C | #include"Menu.h"
int SelectMenu(void){
int num = 1;
printf("-------------\n");
printf("1.л߰\n");
printf("2. \n");
printf("3.̸ \n");
printf("4.л ˻\n");
printf("0.\n");
printf("-------------\n");
printf(" : ");
scanf("%d", &num);
return num;
} |
C | #include "Inf_uint_arr_type.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#define INITIAL_SIZE 4
#define SIZE_STEP 2
static int Add_to_inf_uint_arr(struct inf_uint_arr* inf_uint_arr, const inf_uint_arr_cell new_cell)
{
assert(inf_uint_arr);
if (inf_uint_arr->used_size >= inf_uint... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <SDL2/SDL.h>
#include "Affichage.h"
#include "operation.h"
#include "rotation.h"
#include "resolution.h"
void Resolution (int faceB[3][3], int faceO[3][3], int faceG[3][3], int faceR[3][3], int faceY[3][3], int faceW[3][3], int nbE... |
C | #include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "bloom.h"
unsigned int sax_hash(const char *key)
{
unsigned int h=0;
while(*key) h^=(h<<5)+(h>>2)+(unsigned char)*key++;
return h;
}
unsigned int sdbm_hash(const char *key)
{
unsigned int h=0;
while(*key) h=(unsigned char)*key++ + (h... |
C | /*
* ---------- header ----------------------------------------------------------
*
* project kaneton
*
* license kaneton
*
* file /home/mycure/kane...ine/glue/ibm-pc.ia32/educational/clock.c
*
* created julien quintard [wed nov 24 19:11:47 2010]
* updated julien quintard ... |
C | #include "calc_message.h"
#include <float.h>
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <string.h>
#include <errno.h>
#include <sys/neutrino.h>
#include <pthread.h>
/***********************************************************************************
* File: Msg_Passing_Server.c
*
* Us... |
C | #include <stdio.h>
void main ()
{
int a;
printf ("Enter the no: ");
scanf ("%d", &a);
switch (a)
{
case 1:
printf ("MONDAY");
break;
case 2:
printf ("TUESDAY");
break;
case 3:
printf ("WEDNESDAY");
break;
case 4:
printf ("THURSDAY");
break;
... |
C | #include <stdio.h>
#include <stdlib.h>
int hammingDistance(int x, int y)
{
int z = x ^ y;
int iCnt = 0;
while (z != 0)
{
if (z & 1)
{
++iCnt;
}
z = z >> 1;
}
return iCnt;
}
int main()
{
int x = 1;
int y = 4;
int iRes = hammingDistance(x,... |
C | /********************************************************************/
/* Class: Computer Programming, Fall 2018 */
/* Author: ffE */
/* ID: 107820016 */
/* Date: 2018.12.12 */
/* Purpose: yz */
/* Change History: log the change history of the program */
/***************************************************************... |
C | #include <stdio.h>
#define MAX 500
int multiply(int x, int res[], int res_size)
{
int i, carry = 0, prod = 0;
for (i=0;i < res_size;i++){
prod = res[i] * x + carry;
res[i] = prod % 10;
carry = prod / 10;
}
while(carry){
res[res_size] = carry%10;
carry = carry / 10;
res_size++;
}
return res_size;
}
... |
C | /*
* Copyright (c) 2009 HLRS. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <stdio.h>
#include <string.h>
#include "ADCL.h"
#include "ADCL_internal.h"
#include "mpi.h"
void dump_vector_1D ( double *data, int rank, int dim);
void dump_vector_1D_mpi ( ... |
C | #include <math.h>
int th;
int checkprime(int num){
if(num > th){
printf("Finished. \n");
}else{
int i,r;
for(i=3;i<th;i++){
r=num/i;
if(r*i == num)
}
}
}
int main(){
th=(int)(sqrt((double)(num))+1);
}
|
C | #include <stdio.h>
int n;
int dp[1001];
int main() {
scanf("%d", &n);
dp[1] = 1;
dp[2] = 2;
for (int i = 3; i <= n; i++) {
dp[i] = dp[i - 1] + dp[i - 2];
dp[i] %= 10007;
}
printf("%d\n", dp[n]);
return 0;
} |
C | /********** A really minimal coroutine package for C **********
* By Armin Rigo
*/
#include "src/stacklet/stacklet.h"
#include <stddef.h>
#include <string.h>
#include <stdio.h>
/************************************************************
* platform specific code
*/
/* The default stack direction is downwards, ... |
C | #include <stdio.h>
int main(){
int mult = 0;
printf("Os multiplos de 3:\n");
for(int i = 1; i <= 5; i++){
mult = i * 3;
printf("%d ", mult);
}
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
#include <malloc.h>
struct Student{
char number[20];
char name[20];
char gender[5];
unsigned age;
char address[100];
};
struct Node {
struct Student data;
struct Node* next;
};
//struct Student* create_list(struct Student head)
int main() {
// ... |
C | /*
* @lc app=leetcode id=958 lang=c
*
* [958] Check Completeness of a Binary Tree
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* struct TreeNode *left;
* struct TreeNode *right;
* };
*/
int count_node(struct TreeNode *root)
{
if (!root)
... |
C | #include "lists.h"
#include <string.h>
/**
* add_nodeint_end - a function that adds a new node at the end of
* a listint_t list.
* @head: points to the address of the first node.
* @n: the value int.
* Return: the address of the new element, or NULL if it failed.
*/
listint_t *add_nodeint_end(listint_t **head, c... |
C | /* --------------------------------------------------------------------
-- Company: TEIS AB
-- Engineer: Lasse Karagiannis
--
-- Create Date: 2016-10-01
-- Design Name: uppgift_4a
-- Target Devices: BeMicro Max 10 board
-- Tool versions: Quartus v16 and Eclipse
--
-- In_signals:
-- key_in -- button input button-0,-1,-2... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define STACK_SIZE 100
#define MAZE_SIZE 6
typedef struct StackObjectRec {
short r;
short c;
}StackObject;
StackObject stack[STACK_SIZE];
int top = -1;
StackObject here = { 1,0 }, entry = { 1,0 };
char m... |
C | #ifndef __memory_h_
#define __memory_h_
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcmp() */
#include "debug.h"
#include "process.h"
typedef struct _MemoryModel
{// Represents memory entites in computer (Real Memory and Disk)
int realMemorySize;
int swapMemorySize;
int **realMemory;
i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int getNumbers(char *array);
int getNumbers(char *array){
int numbers = 0;
while(array = strpbrk(array, "0123456789")){
numbers = numbers * 10 + *array++ - '0';
}
return numbers;
}
int main()
{
char *array;
array = malloc(siz... |
C | #include "../domain.h"
inherit "/std/room";
#define FILE DIR + "/rooms/entrance.c"
void setup(void) {
add_area("newbie");
set_short("Северная часть поля");
set_long("Вы остановились у старого мертвого дерева в центре большого поля. " +
" Чуть дальше на юге вы замечаете дорогу, ведущую к городу. Такж... |
C | #include<stdio.h>
#include<math.h>
#include<stdbool.h>
bool judgeSquareSum(int c)
{
int n=(int)sqrt(c);//强制转换
int left=0;
int right=n;
while(left<=right)
{
int tmp=left*left+right*right;
if(c==tmp)
{
return true;
}
if(tmp>c)
{
... |
C | #include <stdio.h>
#include <string.h>
#include "radioSort.h"
void getTxtData(char *filename,Wrap *awp);
void visiteWrap(Wrap wap,char *tips);
int main(int argc,char *argv[]){
Wrap awp = {NULL,NULL,0,0};
getTxtData("data.txt", &awp);
visiteWrap(awp,"基数排序\ndefore sort:");
radioSort(&awp);
visiteWrap(awp,"after s... |
C | #include<stdio.h>
#include<assert.h>
#include<math.h>
int convert(long int);
void main()
{
long int binary;
printf("Enter the Binary number: ");
scanf("%ld",&binary);
printf("\nDecimal value is : %d\n\n",convert(binary));
assert(convert(1010) == 10);
assert(convert(11) == 2);
}
int convert(long int bin)
{... |
C | #include <stdio.h>
#include "./mylib1.h"
int main()
{
int a;
printf("\nEnter ...");
scanf("%d", &a);
int b = lenOfNumber(a);
printf("\n Is %d", b);
return 0;
}
|
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "errors.h"
#include "parser.h"
#include "my.h"
t_parseeye ptr_eye[] =
{
{"position", set_eye_position},
{"rotation", set_eye_rotation},
{NULL, NULL},
};
static void check_arg(t_eye *eye, char **tab)
{
int n;
int check;
... |
C | #include "min.h"
int min(int a, int b){
if(a < b) return a;
else return b;
} |
C | #include<stdio.h>
//int a = 100;
//int main()
//{
// //char ch = 'A';
// //printf("%c\n",ch);
// //int age =20;
// //printf("%d\n",age);
// //printf("%d\n",sizeof(char));
// //printf("%d\n",sizeof(short));
// //printf("%d\n",sizeof(int));
// //printf("%d\n",sizeof(long));
// //printf("%d\n",sizeof(long long));
// //pri... |
C | #include <stdio.h>
main()
{
int i,n;
printf("Bir sayi giriniz: ");
scanf("%d", &n);
if(n>10)
{
printf("%d sayisi 10 veya 10 dan kucuk bir sayi olmali !", n);
}
else
{
for( i=1; i<n; i=i+1 )
{
printf("Sayilan Sayi=%d\n", i);
}
printf("1 il... |
C | #include <stdio.h>
#include "bst.h"
#include "assert.h"
#include "structs.h"
/*----------------------------------------------------------------------------
very similar to the compareTo method in java or the strcmp function in c. it
returns an integer to tell you if the left value is greater then, less then, ... |
C | /*
** main.c for in /home/trambe_m/CPE_2014_corewar/bonus/asmdsm/src
**
** Made by Manuel Trambert
** Login <trambe_m@epitech.net>
**
** Started on Sun Apr 12 17:20:09 2015 Manuel Trambert
** Last update Sun Apr 12 19:57:18 2015 Manuel Trambert
*/
#include <stdlib.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.... |
C | # include <stdio.h>
# include <omp.h>
int a[65536],s,test;
int global_size,global_x,n;
void nary_search(int size,int x)
{
if(size<=n)
{
test=0;
#pragma omp parallel num_threads(n)
{
int tid=omp_get_thread_num();
if(a[x+tid]==s)
{
printf("\n FOUND... %d\n",x+tid... |
C | #include "../include/complex.h"
const char NAME_PLUGIN[] = "Division";
myComplex division(myComplex a, myComplex b) {
myComplex result;
result.Rb = ((a.Rb * b.Rb) + (a.Im * b.Im)) / (pow(b.Rb, 2) + pow(b.Im, 2));
result.Im = ((b.Rb * a.Im) - (a.Rb * b.Im)) / (pow(b.Rb, 2) + pow(b.Im, 2));
return result;
}
|
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
float num1,num2,toplam,farki,carpim,bolme;
printf("Lutfen 1. sayiyi giriniz: \t " );
scanf("%f",&num1);
printf("Lutfen 2. sayiyi giriniz: \t " );
scanf("%f",&num2);
toplam=num1+num2;
farki= num1-num2;
carpim=num1*num2;
bolme=num1... |
C | #pragma once
#include <glm/glm/glm.hpp>
#include "glm/glm/gtc/matrix_transform.hpp"
#include "glm/glm/gtc/type_ptr.hpp"
//vecת
float vec2radi(glm::vec3 dir) {
float radi;
if (dir.x == 0)
{
if (dir.z > 0) radi = glm::radians(0.0f);
else radi = glm::radians(180.0f);
return radi;
}
else if (dir.z == 0)
{
if... |
C | /* -*- indent-tabs-mode: t; tab-width: 2; c-basic-offset: 2; c-default-style: "stroustrup"; -*- */
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include "./event.h"
int events_minimumSleep(struct linked_list *events){
int result = -1;
struct event *current;
while(events){
current = events->data;
... |
C | #include<stdio.h>
// include other libraries if needed
//made to easily print out array
void printArray(int* test, int length){
int i;
for (i = 0; i < length; i++){
printf("%d", test[i]);
if (i != length-1){
printf(",");
}
}
printf("\n");
}
int main() {
int testArray[] = {29, 17, 8, 17, 9, 17, 29,9};
/... |
C | #include<stdio.h>
#include<fcntl.h>
#include<unistd.h>
#include<sys/types.h>
#include<pthread.h>
#include<semaphore.h>
#define MAX_RESOURCES 7
sem_t mutex;
sem_t mutex1;
int available_Licences=MAX_RESOURCES;
/*decrease available resources by count resources*/
void *decrease_count(void *coun)
{ int *co... |
C | #include <stdio.h>
//declaring a function square above the main function
int square(int num);
int main() {
int result,n;
n=6;
for(int i=1;i<n;i++)
printf("The result is: %d\n",square(i));
return 0;
}
int square(int num)
{
int y;
y=num*num;
return(y);
}
|
C | //
// Created by alpharius on 06.08.19.
//
#include "interpolate.h"
//#include
#define TEST//NOT_TEST
// TODO - написать динамически линкуемую версию полинома лагранжа
// не оптимизированные полиномы Лагранжа.
double Lagrange_polinom_interpolation(double x, double* x_set, double* y_set, size_t len){
double resul... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.