language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int number;
printf("Enter a number : ");
scanf("%d" , &number);
if (number%2 == 0){
printf("%d is even number." , number);
}
//if (number%2 == 0){
// printf("%d is odd number." , number);
//}
... |
C | /* Author: christopherluu
* Partner(s) Name:
* Lab Section:
* Assignment: Custom Project
* Exercise Description: [optional - include for your own benefit]
*
* I acknowledge all content contained herein, excluding template or example
* code, is my own original work.
*/
#include <avr/io.h>
#include "timer.h"
#i... |
C | /*
* Illustration of pthread_cond_wait(pthread_cond_t*, pthread_mutex_t*) and
* pthread_mutex.
* Order threads in order using the above.
* https://leetcode.com/problems/print-in-order/
*/
typedef struct {
// User defined data may be declared here.
pthread_mutex_t mlock;
pthread_cond_t first;
p... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int i;
printf("난수의 범위 : 0부터 99까지 \n");
for(i=0; i<5; i++)
printf("난수 출력 : %d \n", rand()%100);
} |
C | #include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "../../libft.h"
int main()
{
char dst1[0xF00] = "there is no stars in the sky";
//char *src = "the cake is a lie !\\0I'm hidden lol\\r\\n";
char dst2[0xF00] = "there is no stars in the sky";
char *src = "the cake is a lie !\0I'm hidde... |
C | /* testing */
#include <stdio.h>
#include <stdlib.h>
#include <ucontext.h>
#include <sys/time.h>
#include <signal.h>
volatile sig_atomic_t keep_going = 1;
struct gtthread_t
{
long int id;
struct gtthread_t* next; //pointer to next node
int terminted;
}gt[2];
struct itimerval timer;
ucontext_t ctxt_main, ctxt_t1... |
C | //使用环境windoes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXLEN 100
typedef struct string
{
char ch[MAXLEN];
int len;
}SString,*PSString;
void StrReplace(PSString ps,SString t,SString v);
int StrLength(SString n);
int Index(PSString s,SString t,int pos) ;
int main(vo... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define MOD_VALUE 50
int unique_number(int *arr, int x)
{
int i;
for (i=0; i<MOD_VALUE; i++) {
if (x == arr[i])
return 1;
}
return 0;
}
int generate_unique_random(int *arr)
{
int n = 0;
int i,j;
//srand (time(NULL));
#if 1
whi... |
C | #include <stdio.h>
#include <ulib.h>
#define ARRAYSIZE (1024*1024)
uint32_t bigarray[ARRAYSIZE];
int
main(void) {
cprintf("Making sure bss works right...\n");
int i;
for (i = 0; i < ARRAYSIZE; i ++) {
if (bigarray[i] != 0) {
panic("bigarray[%d] isn't cleared!\n", i);
}
}
... |
C | #include<stdio.h>
#include<stdlib.h>
int a[100], n;
int DI(int li, int ls) {
int x, y;
if (li < ls) {
x = DI(li, (li + ls) / 2);
y = DI((li + ls) / 2 + 1, ls);
if (x < y) return y;
else return x;
}
else
return a[li];
}
int main() {
int i;
printf("n=");
scanf("%d\n", &n);
for (i = 0; i < n; i++) {... |
C | /*======================================================
> File Name: 2.c
> Author: wwh
> E-mail:
> Other :
> Created Time: 2015年12月26日 星期六 01时53分45秒
=======================================================*/
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
i... |
C | /* Copyright 2014 Dietrich Epp.
This file is part of SGLib. SGLib is licensed under the terms of the
2-clause BSD license. For more information, see LICENSE.txt. */
#ifndef SG_RECORD_H
#define SG_RECORD_H
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
struct sg_error;
/**
* @file sg/record.h
*
* ... |
C | #include <stdio.h>
#define N 10
int main(void)
{
int i,j;
for(i=0;i<N;i++){ //1~10
for(j=N-i-1;j>0;j--){ //9>0̽
printf(" ");
}
for(j=0;j<i;j++){//iŭ
printf("");
}
for(j=0;j<i-1;j++){//i-1ŭ
printf("");
}
printf("\n");
}
return 0;
}
|
C | #include "lists.h"
/**
* reverse_listint - reverses a listint_t linked list.
* @head: pointer to the first node
* Return: pointer to the first node
*/
listint_t *reverse_listint(listint_t **head)
{
listint_t *rev = NULL;
listint_t *next = NULL;
while (*head)
{
next = (*head)->next;
(*head)->next = rev;
... |
C | #include <stdio.h>
int fun(int n){
static int x=0;
if(n>0){
x++;
return fun(n-1)+x;
}
return 0;
}
int main(){
printf("%d \n",fun(6));
return 0;
}
|
C | /*******************************************************************************
*
* Name: thinning_functions.c
* Author: K. Palagyi
* Date: 14 November, 2013
*
*******************************************************************************/
/*=============... |
C | #include <stdio.h>
#include <stdlib.h>
//跨函数动态内存分配
struct student{
int sid;
int age;
};
struct student * createStudent(void);
void show(struct student *p);
int main()
{
struct student *st;
st = createStudent();
show(st);
return 0;
}
struct student * createStudent(void)
{
struct student *p = (struct stude... |
C | #include <stdio.h>
#include <stdlib.h>
struct Node{
int data;
struct Node *next;
};
struct Node *push(struct Node **head , int data){
struct Node *temp = (struct Node *)malloc(sizeof(struct Node));
temp->data = data;
temp->next = *head;
*head = temp;
return temp;
}
void traverse_list(struct ... |
C | #include "splay-tree.h"
#include <stdio.h>
#define NumItems 500
int main(void)
{
SplayTree T;
SplayTree P;
int i;
int j = 0;
T = Initialize();
T = MakeEmpty(T);
for (i = 0; i < NumItems; i++, j = (j + 7) % NumItems)
T = Insert(j, T);
for (j = 0; j < 2; j++)
for (i = 0; i < NumItems; i++)
{
T = Find(... |
C | int test(int a,int b)
{
if( a >= b) return a;
else return b;
}
int main()
{
int x = 2;
int y = 3;
return test(x,y);
} |
C | /*
* stack.h
*
*/
#ifndef STACK_H_
#define STACK_H_
#include "stack_item.h"
typedef struct {
/** reference to the top item */
StackItem *top;
/** size of the stack */
int num;
} Stack;
Stack * initializeStack();
void push(int* data, int step, int i, int j, int movedDisc);
int* top(int* step, int* i, int* j... |
C |
/*
simple code for toggling output with digital input
*/
// ------- Preamble -------- //
#include <avr/io.h> // Defines pins, ports, etc
#include <util/delay.h>
#define BUTTON_PIN PINB
#define BUTTON PB4
#define LED_DDR D... |
C | #include <stdio.h>
int ft_str_is_lowercase(char *str);
int main(void)
{
char lower[] = "abcdefghijklmnopqrstuvwxyz";
char *p_low;
p_low = lower;
char special[] = "ABC abc áéíóú àèìòù âêîôû äëïöü \'\"(){}[]!?@#$&* wxyz WXYZ";
char *p_spe;
p_spe = special;
char empty[] = "";
char *p_emp;
p_emp = empty;
... |
C | #include "io.h"
// проигнорировать невалидную строку
void skip_str() {
char ch;
while (read(0, &ch, 1) > 0 && ch != '\n') {}
}
// проверка числа на валидность
bool is_valid(char* buf) {
int i = 0;
int count_of_dots = 0;
while (buf[i] != '\0') {
if (isdigit(buf[i]) || buf[i] == '.') {
... |
C | /*******************************************************************************
* PRIMME PReconditioned Iterative MultiMethod Eigensolver
* Copyright (C) 2005 James R. McCombs, Andreas Stathopoulos
*
* This file is part of PRIMME.
*
* PRIMME is free software; you can redistribute it and/or
* modify ... |
C | #include "../CCEL_MONAD.h"
#define list_typeof(type)\
typedef struct node_##type Node_##type;\
typedef struct list_##type List_##type;\
struct node_##type {\
type data;\
struct node_##type * next;\
};\
struct list_##type {\
Node_##type * head; \
};\
Node_##type * createnode_##type(type data);\
Node_##type * crea... |
C |
/* Code for problem 2 (pg 205) */
/* Compiling as "gcc -o coin2 coin2.c", what error might you expect? */
#define HEADS 0
#include "some_library.h"
char * Flip_A_Coin(int x)
{
if (x%2 == HEADS)
return("heads");
else
return("tails");
}
main()
{
printf("%s\n",Flip_A_Coin(1));
}
|
C | //
// setting.c
// practice_member
//
// Created by 長澤達也 on 2019/11/16.
// Copyright © 2019 長澤達也. All rights reserved.
//
#include "setting.h"
//*******ここから:scoringのパラメータ設定********
court_rank set_court_rank(void){
//各面内のランク差による評価.ランクの最大値-最小値が小さいほど高評価.
//比率を大きくするとランク差が小さい組み分けが出やすくなる.
//計算式はcourt_score... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
int main(int argc, char**argv)
{
FILE* fps;
FILE* fpd;
if(argc < 3)
{
fprintf(stderr, "Usage: %s <sourceFile> <DestFile>\n", argv[0]);
exit(1);
}
fps= fopen(argv[1], "r");
if(fps == NULL)
{
perr... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_itoa_base_ulong.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<conio.h>
main()
{
int n;
void fib(int);
printf("\nEnter No. Of Terms :");
scanf("%d",&n);
fib(n);
getch();
}
void fib(int n)
{
int a=-1,b=1,s=0,i=1;
while(i<=n)
{ s=a+b;
printf("%d\t",s);
a=b;
b=s;
... |
C | /* MD5.c : Defines the entry point for the console application.*/
/*
* After becoming frustrated with the lack of a standalone, portable,
* decent random number generator, I decided to make one based on a
* cryptographic one-way hash function. I chose MD5 since it is fast
* and free source was readily availabl... |
C | /* BNBT BitTorrent EasyTracker Remote Denial Of Service
Versions:
Version 7.7r3.2004.10.27 and below
Vendors:
http://bnbt.go-dedicated.com/
http://bnbteasytracker.sourceforge.net/
http://sourceforge.net/projects/bnbtusermods/
Bug find and coded by:
Sowhat@@secway@org
http:... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int num;
int divisor;
int isprime; //true if num is positive
printf("Enter a number:");
scanf("%d", &num);\
divisor = 2;
isprime = 1; // true
while(isprime && divisor*divisor < num){
//check if number is divisb... |
C | /**
* @defgroup host host
* @{ @ingroup networking
*/
#ifndef __SOCKET_HOST_H__
#define __SOCKET_HOST_H__
typedef struct host_t host_t;
#include <utils/utils.h>
#ifndef _WIN32
#include <stdint.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <utils/utils.h>... |
C | //
// calcDragAndTorque.h
// DEMsd
//
// Created by Ryohei SETO on 12/03/20.
// Copyright (c) 2012 Ryohei Seto. All rights reserved.
//
#ifndef stodyn_calcDragAndTorque_h
#define stodyn_calcDragAndTorque_h
#include <fstream>
#include <iomanip>
#include <cstdlib>
#include "sdsystem.h"
void outputVector(ofstream &f... |
C | #include <windows.h>
#include <stdio.h>
#define SLEEP_TIME 5000
SERVICE_STATUS ServiceStatus;
SERVICE_STATUS_HANDLE hStatus;
void ServiceMain(int argc, char** argv);
void ControlHandler(DWORD request);
//add the payload here
int Run()
{
/* system("whoami > c:\\windows\\temp\\service.txt"); */
system(... |
C | #include <stdio.h>
#include<string.h>
void pelindrom(char a[] , int l , int l1)
{
static int j=0,i=0;
if(i==l1/2)
printf("Your string is pelindrom.");
else if(a[i]==a[l-1] && i<l1/2 && j!=l1)
{
i=i+1;
j=j+1;
pelindrom(a,l-1,l1);
}
else
pr... |
C | /****************************** (C) COPYRIGHT 2016 *******************************
*
* ܣij˷
* Ҫ㣺
* ע⣺άʹúͬһά飬ָ룬ָ飬ָ
*
********************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void Init2(int arr[][2]);
void Init1(int arr[][3... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
void catch_signalrm(int signo)
{}
unsigned int mysleep(unsigned int seconds)
{
struct sigaction act, oldact;
int ret;
act.sa_handler = catch_signalrm;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
ret = sigaction(S... |
C | /**
* author: UncP
* date: 2018-11-20
* license: BSD-3
**/
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include "../palm/allocator.h"
#include "node.h"
blink_node *new_blink_node(uint8_t type, uint8_t level)
{
#ifdef Allocator
blink_node *bn = (blink_node *)... |
C |
#include <stdio.h>
#include <string.h>
int main()
{
int cases, i = 1;
char s[80], r[80];
char h[][20] = { "tesoura", "papel", "pedra", "lagarto", "Spock" };
scanf ( "%d", &cases );
while ( i <= cases )
{
scanf ( "%s %s", s, r );
if ( strcmp ( s, r ) == 0 ) printf ( "Caso #%d: De novo!... |
C | #include <stdlib.h>
#include <stdio.h>
int main()
{
float n1, n2;
FuerzaYSuperficie(n1, n2);
}
void FuerzaYSuperficie(float num1, float num2)
{
float pre=0;
printf("Ingrese la fuerza ");
scanf("%f",&num1);
printf("Ingrese la superficie ");
scanf("%f",&num2);
pre=num1/num2;
system("cls");
print... |
C | /* Write C programs to simulate the following memory management techniques
a) Paging b) Segmentation */
// a) Paging
#include <stdio.h>
struct pstruct
{
int fno;
int pbit;
}ptable[10];
int pmsize,lmsize,psize,frame,page,ftable[20],frameno;
void info()
{
printf("Enter the Size of Physical memory: ");
scanf("%d... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* errors.c :+: :+: :+: ... |
C | //
#define _CRT_SECURE_NO_WARNINGS
//#include<stdio.h>
////1.将数组A中的内容和数组B中的内容进行交换。(数组一样大)
//void swap(int arr1[]; int arr2[]; int leng)
//{
// int i = 0;
// for (i = 0; i < leng; i++)
// {
// int t = arr1[i];
// arr1[i] = arr2[i];
// arr2[i] = t;
// }
//}
//int main()
//{
// int i = 0;
// int arr1[5] = { 1, 2, 3, 4... |
C | #include <stdio.h>
#include<stdlib.h>
char a[100];
struct sll
{
int data;
struct sll *next;
}*head=NULL,*temp,*newn;
void create(char d)
{
newn=(struct sll *)malloc(sizeof(struct sll));
newn->data=d;
newn->next=NULL;
if(head==NULL)
{
head=newn;
}
else
{
temp=head;
head=newn;
head->next=temp;
}
}
int ... |
C | /*
* Sieci komputerowe, Zadanie 1 (prosty serwer HTTP).
* Autor: Andrzej Stalke
* Opis pliku: Funkcja main programu.
*/
#include "tcp_handler.h"
#include "http.h"
#include "correlated.h"
/*
* Funkcja pomocnicza. Konweruje wejściowy ciąg znaków str do unsigned short
* int. Wykorzystywana do wczytania numeru por... |
C | #include "trabajo.h"
#ifndef INFORMES_H_INCLUDED
#define INFORMES_H_INCLUDED
int validarIdTipo(int id, eTipo tipos[], int tam);
int validarIdColor(int id, eColor colores[], int tam);
/** \brief muestra un listado de motos del color seleccionado
*
* \param motos[] eMoto array de motos
* \param tam int tamani... |
C | int main()
{
struct student{
int number;
int chinese;
int math;
int sum;
}students[100000];
int n,i;
int a1,b1,a2,b2,a3,b3;
int c1,c2;
int max=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%d%d",&students[i].number,&students[i].chinese,&students[i].math);
students[i].sum... |
C | #include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/seq_file.h>
#include <linux/proc_fs.h>
static int print_something(struct seq_file *m, void *v) {
seq_printf(m, "Hello. It's me\n");
return 0;
}
static int file_open_proc(struct inode * inode, struct file * file) {
return si... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "linkedList.h"
typedef struct listElementStruct{
char* data;
size_t size;
struct listElementStruct* next;
} listElement;
//Creates a new linked list element with given content of size
//Returns a pointer to the element
listElement*... |
C | #include "stdlib.h"
#include "stdio.h"
#include "string.h"
#include "des.h"
void main()
{
int ret = 0;
unsigned char plain[100];
int plainlen = 0;
unsigned char plain2[100];
int plain2len = 0;
unsigned char cryptdata[100];
int cryptlen = 0;
strcpy(plain, "abcdefgdafdsafdsafd");
plainlen = strlen((char *... |
C | #include <stdio.h>
#include <malloc.h>
int main(void){
int array13[][3]={{1,2,3}};
int array23[][3]={{4,5,6}};
int (*(*p)[2])[3];
p=(int (*(*)[2])[3])malloc(1 * sizeof(int (*(*)[2])[3]));
p[0][0]=array13;
p[0][1]=array23;
printf("%d\n",p[0][0][0][1]); //2
printf("%d\n",p[0][1][0][1]); // 5
}
|
C | //Despoina Zografidou 321/2016041
#include<stdio.h>
struct activity
{
char a[5];
int start;
int finish;
};
void activitySelection(struct activity activities[],int n)
{
int i,j;
struct activity temp;
for(i=0; i<n; i++)
{
for(j=0; j<n-1; j++)
{
... |
C | //Mutlak hesabi ? ile.
#include <stdio.h>
int main()
{
int sayi =0;
printf("Sayiyi giriniz: ");
scanf("%d",&sayi);
sayi = (sayi<0) ? sayi*(-1) : sayi;
printf("Sayinin mutlagi: %d",sayi);
return 0;
} |
C | /* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Library for creating subprocesses in a high level manner.
*/
#ifndef VBOOT_REFERENCE_SUBPROCESS_H_
#define VBOOT_REFERENCE_SUBPROCESS_H_
#include <stdio.h>
#include <... |
C | #include <stdlib.h>
#include <stdio.h>
#include <stdbool.h
#include "tree.h"
struct tree;
struct attributes;
enum type {tree, word};//typage des noeuds: permet de savoir si un noeud construit un arbre ou s'il s'agit simplement de texte
struct attributes{
char* key;//nom de l'attribut
char* value;//valeur de l'att... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "patate.h"
int main(int argc, char** argv)
{
int i, pid, p;
int pipes[3][2];
/*int fd = open("toto", O_RDONLY);
lancer_patate(1, 56);
printf(" <<< lance dans stdout \n");
fflush(stdout);
... |
C | #include <stdlib.h>
typedef struct node_t{
int *arr; //length n always
struct node_t * next;
} node_t;
typedef struct list_t {
node_t * head;
int len;
} list_t;
void insert_into_list(list_t * list, int *arr, int n);
int * remove_from_list(list_t *list);
int empty_list(list_t * list);
|
C | #include <stdio.h>
int main()
{
int num_funcionario;
int num_hora;
float valor_hora;
float salario;
scanf("%d", &num_funcionario);
scanf("%d", &num_hora);
scanf("%f", &valor_hora);
salario = valor_hora*num_hora;
printf("NUMBER = %d\n", num_funcionario);
printf("SALARY = U$ %.... |
C |
#define SIZE 5
unsigned char min (unsigned char tab[], unsigned char size, unsigned char n) {
unsigned char i, min_index, min;
if (size == 0) return 0;
min_index = n;
min = tab[min_index];
for (i = n+1 ; i < size ; i++) {
if (tab[i] < min) {
min_index = i;
min = tab[min_index];
}
}
... |
C | /**
* @brief Implement GPIO section of miscellaneous/testing_plan
* @author Francois Berder
* @date 2016
* @copyright 3-clause BSD
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include <letmecreate/core/gpio.h>
static bool test_gpio_get_set_direction_invalid_gpio(void)
{
... |
C | #include<stdio.h>
#include<tm_dll.h>
int main()
{
int i1,i2,i3,i4,i5,i6;
int *x;
bool succ;
DoublyLinkedList *list1;
DoublyLinkedListReverseIterator iter;
list1=createDoublyLinkedList(&succ);
if(succ==false)
{
printf("Unable to create list\n");
return 0;
}
i1=100;
i2=200;
i3=300;
i4=400;
i5=500;
i6=600;
addToDoublyL... |
C | int factorsum( int number ){
int sum=0;
if(number==1)
return 1;
else{
for(int i=1;i<number;i++)
if(number%i==0)
sum+=i;
return sum;}
}
void PrintPN( int m, int n ){
int flag=0;
while(m==1){
flag=1;
printf("1 = 1\n");
m++;
}
for(int i=m;i<=n;i++){
... |
C | // program to enter the numbers till the user wants and at the end
//it should display the count of positive, negative and zeros entered.
#include<stdio.h>
int main()
{
int num,positive=0,negative=0,zero=0;
char choice;
do
{
printf("Enter the number: \n");
scanf("%d",&num);... |
C | #include <stdio.h>
int main() {
int num;
printf("This program displays all even squares between 1 and an input\nPlease enter a positive integer: ");
scanf("%d", &num);
for (int i = 1; i*i < num; i++){
if (i % 2 == 1)
continue;
else
printf("%d\n", i*i);
if (i*i > num)
break;
}
... |
C | /*Equipe:Leandro Monteiro Guimares Matrcula: 0286756
Murilo Lima de Holanda 0286740
Paulo Srgio V. Alves Jnior 0288809 */
/*Obs: O algoritmo s funcionar se o arquivo a ser lido estiver no seguinte padro:
Linha 1: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lzw.h"
inline int min(int a, int b);
void compress_file(FILE* file_input, FILE* file_output);
int compress_buffer(char *buffer, int length, int start, int end,
struct triple *output, FILE* file_out);
inline int min(int a, int b)
{
return ... |
C | #include <random>
double monteCarlo(long long num) {
srand(time(NULL));
long long inside = 0;
for (long long i = 0; i < num; i++) {
double x = (double)rand() * 2 / (double)RAND_MAX - 1;
double y = (double)rand() * 2 / (double)RAND_MAX - 1;
if (x * x + y * y <= 1) {
inside += 1;
}
}
retu... |
C | /*
* Program to sort in ascending order and printing unique intergres.
* @Author: Malay Bhavsar
*/
#include <stdio.h>
int main()
{
int n;
printf("Enter number of elements:");
scanf("%d", &n);
int arr[n], count = -1, j = 0, temp;
for (int i = 0; i < n; i++)
{
printf("En... |
C | // ADT for a FIFO queue
// COMP1521 17s2 Week01 Lab Exercise
// Written by John Shepherd, July 2017
// Modified by Andrew Walls, z5165400
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "Queue.h"
typedef struct QueueNode {
int jobid; // unique job ID
int size; // size/duration of job
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* calc.c :+: :+: :+: ... |
C | /*
Progetto Reti di Calcolatori A.A. 2019/2020 di Michele Sanfilippo - prof.re Biagio Lenzitti
Creazione comunicazione tra server e client attraverso protocollo TCP/IP
Tale protocollo sfrutta la comunicazione del protocollo TCP usufruendo al tempo stesso di un indirizzo IP
per l'invio e ricezione di pacchetti dati.
... |
C | /*find size of different types*/
#include <stdio.h>
int main(void) {
printf("%ld\n",sizeof(float));
printf("%ld\n",sizeof(int));
printf("%ld\n",sizeof(char));
} |
C | /**
* @file include/mcube/rwlock.h
*
* @author Hiroyuki Chishiro
*/
#ifndef __MCUBE_MCUBE_RWLOCK_H__
#define __MCUBE_MCUBE_RWLOCK_H__
#ifndef __ASSEMBLY__
/**
* @struct rwlock
* @brief Read/Write lock
*/
struct rwlock {
/** Number of readers. */
unsigned int nread;
/** Writer lock. */
spinlock_t wlock;... |
C | /* 问题描述:某些数能分解成若干个连续整数的和的形式, 如:
15 = 1 + 2 + 3 + 4 + 5
15 = 4 + 5 + 6
15 = 7 + 8
输入格式:一个正整数 N (N ≤ 10000)
输出格式:N 对应的所有分解组合。按照每个分解中的最小整数从小到大输出, 每个分解占一行。
... |
C | ///\file
///\brief Define Record structure
///Represents word and its interpretation
typedef struct _Record {
char * word;
char * interpret;
} Record;
/**
* Create new Recrod for word ant its meaning
* \param w, i word and its interpretation
* \return pointer to new Record
*/
Record * createRecord(char ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <stdbool.h>
int maxArea(int* height, int heightSize) {
assert(height != NULL && heightSize >= 2);
int l = 0, r = heightSize - 1;
int max = 0;
while(l < r) {
int tmp = (r - l) * (height[r] > height[l] ? he... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | #include<stdio>
int main()
{
int a=9;
int b=23;
int c;
c=a+b;
printf("%d",c);
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
void *ptr = malloc(100);
void *ptr2 = ptr;
printf("%p\n", ptr);
printf("%p\n", (int*)ptr + 1);
printf("%p\n", (int*)ptr - 1);
printf("%p\n", (int *)++ptr2);
printf("%p\n", (int *)--ptr2);
printf("%p\n", (int*)ptr2++);
printf("%p\n", (int*)ptr2--)... |
C | #include<stdio.h>
int main()
{
int i,a=5;
for(i=1 ; i<=5 ; i++)
{
scanf("%d",&a);
printf("%d\n\n",a);
}
return 0;
}
|
C | #include <stdio.h>
int main(void) {
int i = 1;
goto s11;
s00: puts("FizzBuzz"); i++; goto s11;
s01: puts("Fizz"); i++; goto s12;
s02: puts("Fizz"); i++; goto s13;
s03: puts("Fizz"); i++; goto s14;
s04: puts("Fizz"); i++; goto s10;
s10: puts("Buzz"); i++; if (i ... |
C | #define QSIZE 20 //realistically, this thing should never have more than 1 item at a time.
typedef struct swevent {
unsigned int pr : 1 ; //press-release bit: 1 -- switch was pressed; 0 -- switch was released
unsigned int sw : 7 ; //switch number for this event (with room for expansion)
unsigned int msec : ... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct node {
int src;
int dest;
int weight;
};
int get_index(char *city, char *ar[], int *index)
{
int i;
for(i = 0; i < (*index); i++) {
if(strcmp(ar[i], city) == 0) {
return i;
}
}
ar[*index] = city;
return (*index)++;
}
int comp(const void *... |
C | /* $title: 'FCREATE.C ===== Create empty file or wipe existing =====' */
/* $subtitle: 'Elipse Ltd. (jms) Revised: 1995 Sep 04' */
#include <stdio.h>
/* MAIN ===== Program start up ===== $pageif:6 */
int main( int argc, char *argv[] )
{ /* main */
... |
C | #include<omp.h>
#include<stdio.h>
/*
CSCI6454 UNO - Fall 2020
HW1 - Question 2
Daniel Murphy
A very simple Hello World program using 10 OMP threads
note: some code derived from lecture slides
*/
int main(){
printf("Creating 10 POSIX threads, \neach calling the \"SayHello\" function\n\n");
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* crop.c :+: :+: :+: ... |
C | #include "cards.h"
#include "vector.h"
#include "deck.h"
#include "utils.h"
#define ZERO_EXTENTION 0
#define DECK_PREFIX "Current Deck:"
#define ACTIVE_MAGIC_NUM 0xdecdec
#define IS_VALID(D) ((D) && (D)->m_magicNum == ACTIVE_MAGIC_NUM)
#define CARDS(D) (D)->m_cards
struct Deck
{
int m_magicNum;
Vector* m_cards;
}... |
C | /* HEAP SORT
* 151008 ¹
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void swap(int arr[], int i, int j){
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
void max_heapify(int arr[], int i, int heapSize){
int leftIndex = 2 * i;
int rightIndex = 2 * i + 1;
int maxIndex;
if (... |
C | //install to compile: sudo apt-get install libgtk-3-dev
//Compile with: gcc `pkg-config --cflags gtk+-3.0` -o 1329256 1329256.c `pkg-config --libs gtk+-3.0`
/*
Program: SAIMT inventory management system
Antonio Diaz Flores
A01329256
Oscar Barbosa Aquino
A01329173
Date: 16/11/18
*/
#include <gtk/gtk.h>
#in... |
C | #include <stdio.h>
int
main(void)
{
int lower = 0; // FALSE
int in = 1234567890;
int ex = in;
char buf[50]; /* i never know how much to allocate */
char *out = &buf[49];
for (; in; in >>= 3) {
*--out = '0' + (in & 7);
}
printf("integer: '%i'\n", ex);
printf("calculated answer: '%s'\n", out);
printf("musl... |
C | // Copyright (c) 2012 MIT License by 6.172 Staff
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
/* Typedefs */
typedef uint32_t data_t;
/* Insertion sort */
void isort(data_t *left, data_t *right) {
data_t *cur = left + 1;
while (cur <= right) {
data_t val = *cur;
data_t *index = cur - 1;
... |
C | //#include <stdio.h>
//
//void main() {
// //迭, ʱȭ
// int arr[] = { 1, 7, 14, 17, 26, 59, 63, 77, 79, 87, 88, 90 };
// int lower = 1, higher = 12, m;
//
// printf("1. ã ϴ Ű : 77\n"); //Ű 77
//
// int key1 = 77; // ʱȭ
// int i1 = 0;
//
// while (lower <= higher) {
// m = (lower + higher) / 2;
// if (key1 > arr[m])... |
C | /*
* @Website: https://ntutn.top
* @Date: 2019-12-11 00:46:25
* @LastEditors: zero
* @LastEditTime: 2019-12-11 18:44:43
* @Description: 哲学家进餐问题
* @FilePath: /os/philosopher/philosopher.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <pthread.h>
#include <unistd.h>
//哲学家数量
#define N ... |
C | // Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
C | /*
* UART.c
*
* Created on: Oct 14, 2014
* Author: CTCNGH
*/
#include "include.h"
//void delay_ms(uint16_t period);
void ConfigUART4(void)
{
USART_InitTypeDef USART_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable GPIO clock */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENA... |
C | #ifndef __LSTM_XML_H__
#define __LSTM_XML_H__
#include <stdio.h>
// XML parsing state
struct LSTM_XML_PSTAT
{
int brStr; // Status of reading string in bracket
int aStrA; // Append string to list after append character
int aStrB; // Append string to list before append character
};
// XML attribute structure
struc... |
C | #include <stdio.h>
#include <math.h>
//#include <malloc.h>
#include <stdlib.h>
#define K 13
#define DK 6
/*--------------------------------------------------------------------------------------*/
double roundval( double x )
{
if ( x > 0.0 )
return( floor(x+0.5) );
else
return( -floor(-x+0.5) );
}
/*----... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.