language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "initiator.h"
void printList(ContentServerList** head)
{
// print the Content Server List (created by -s argument)
printf("===ContentServerList===\n");
ContentServerList* temp = *head;
while(temp!=NULL)
{
printf("[*] %s\n",temp->cs);
temp = temp->next;
}
printf("===End Of List===\n");
}
void deco... |
C | /*
* Copyright Ville Valkonen 2010 - 2016.
* Partly borroved from here:
* http://stackoverflow.com/questions/1636333/download-file-using-libcurl-in-c-c
* http://curl.haxx.se/libcurl/c/progressfunc.html
*/
#include <curl/curl.h>
#include <curl/easy.h>
#include <err.h>
#include <errno.h>
#include <stdio.h>
#includ... |
C | /**
* Created by Pieter De Clercq.
*
* Project: huffman
*/
#ifndef HUFFMAN_IO_INPUT_BIT_INPUTSTREAM_H
#define HUFFMAN_IO_INPUT_BIT_INPUTSTREAM_H
#include "byte_input_stream.h"
/**
* An input stream for bits.
*/
struct bit_input_stream;
/**
* A function that reads a byte
*/
typedef byte (*_bit_input_feed_byt... |
C | /*
* Filename: tavernAction.c
* Author: Charles Li
* Description: Prompts the player for their choice of action while in a tavern
* Date: Jun 30 2017
*/
#include "proj.h"
#include "projStrings.h"
void tavernAction( struct Player* player, struct InnKeep* keep ) {
long choice = 0;
char yesNo = 0;
while(1) {... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#define TAM 10
#define MAX 20
char ****associar3(int x, int y, int z, int w){
char ****p; //Matriz que recebe os Calloc
int i,j,k; //variveis da matriz
//aloca as linhas da matriz
p=(char****)calloc(x,sizeof(char***))... |
C | #include<stdio.h>
main()
{
int sum[200],i,test,input[200],output[200];
scanf("%d",&test);
for(i=0;i<test;i++)
{
scanf("%d",&input[i]);
sum[i]=summat(input[i]);
}
for(i=0;i<test;i++)
{
printf("%d\n",sum[i]);
}
}
int summat(int val)
{
int sum=... |
C | /*
* Copyright (c) 2015 SINA Corporation, All Rights Reserved.
*
* stk_list.h: Yilong Zhao yilong@sina.cn
*
* simple tool kit: double list.
*/
#ifndef __STK_LIST_H
#define __STK_LIST_H
#include <stddef.h>
#if 0
#include <stdlib.h>
#endif
typedef struct stk_list_s stk_list_t;
struct stk_list_s {
struct... |
C | /*
** EPITECH PROJECT, 2021
** B-CPP-300-MPL-3-1-CPPD03-cyril.grosjean
** File description:
** join
*/
#include "string.h"
void join_c(string_t *this, char delim, const char * const * tab)
{
char delimiter[1];
delimiter[0] = delim;
this->assign_c(this, tab[0]);
for (int i = 1; tab[i] != NULL; i += 1)... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
int load_config(const char *path, struct cfg_info *cfg)
{
char *cfg_path = NULL;
int cfg_fd = 0;
char cfg_buf[1024];
FILE *cfg_file = NULL;
size_t len = 0;
ssize_t read_len = 0;
char *line = NULL;
char *vcfg = NULL;
// check c... |
C | #include <stdio.h>
#include "Headers/Stack.h"
Stack::Stack(){
start=NULL;
}
Stack::~Stack(){
List_of_Return_Addresses *p1=start;
List_of_Return_Addresses *p2;
while (p1!=NULL){
p2=p1->pointer;
delete p1;
p1=p2;
}
}
void Stack::Push(const int a){
if (start==NULL){
start=new List_of_Return_Addresses;
... |
C | #include <stdio.h>
/* Write a program to print all input lines that are longer
than 80 characters. */
#define MAXLINE 10000
int mygetline(char *, int);
int
main() {
int len;
char line[MAXLINE];
while ((len = mygetline(line, MAXLINE)) > 0) {
if (len > 80) {
printf("%s", line);
... |
C | /*
* vmss_bitfields.c
* Lab2a
*
* Created by Alexey Streltsow on 3/30/10.
* Copyright 2010 Zila Networks LLC. All rights reserved.
*
*/
#include "vmss_bitfields.h"
#include <stdio.h>
const char* bits2string(INTFIELD* fld) {
static char sbits[128];
// sbits[0] = fld->bits[0].v ? '1' : '0';
// sbits[1] = ':... |
C | #include <stdio.h>
int main(int argc, char **argv){
if (argc!=3) {
fprintf(stderr,"USAGE: mv sourcefile destfile\n");
return 1;
}
if (rename(argv[1],argv[2])==-1){
perror("mv");
return 1;
}
return 0;
}
|
C | #include <stdio.h>
void main()
{
unsigned long long int n;
n = 7000000000;
n = n * 1.015;
printf("%llu withh be the population after x years", n);
} |
C | /* C Program to Calculate Square of a Number */
#include<stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int number, Square;
char *a = argv[1];
// printf(" \n Please Enter any integer Value : ");
//scanf("%d", &number);
number = atoi(a);
Square = number * number;
printf("\n Square o... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define ROW 3
#define COL 4
void count(int A[][COL], int num_rows, int num_cols);
void fillRandom(int A[][COL], int num_rows, int num_cols);
void printArray(int A[][COL], int num_rows, int num_cols);
int main(){
int A[ROW][COL];
srand(time(NULL));
fillRandom(... |
C | #include <stdio.h>
/**
* main - get biggest prime factor of given number
* do it like stack overflow 24166478
* no need for sieve
* Return: 0
*/
int main(void)
{
long int d, n;
n = 612852475143;
d = 2;
while (d < n)
{
if ((n % d) == 0)
{
n = n / d;
d--;
}
d++;
}
printf("%li\n", n);
return... |
C | #include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int i=0, meter;
while (i<3)
{
meter = i * 1609;
printf("%d %d Դϴ.\n", i, meter);
i++;
}
return 0;
}
|
C | #include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
int main(int argc, string argv[])
{
if(argc!=2)
{
printf("Enter one Key\n");
return 1;
}
else
{
int k=atoi(argv[1]);
string text = GetString();
for(int i=0,n=strlen... |
C | #include <stdio.h>
#include <omp.h>
int main()
{
//#pragma omp parallel
#pragma omp critical
{ printf("Bonjour je suis le thread numero %i!\n",omp_get_thread_num);
//#pragma omp barrier
printf("Au revoir je le thread numero! %i\n",omp_get_thread_num);}
return 0;
}
|
C | /***************************
File: Multilookup
Nick Trierweiler
**************************/
#include "util.h"
#include "queue.h"
#include "multilookup.h"
char * OUTPUT_FILE;
char errorstr[SBUFSIZE];
int NUM_FILES;
int num_queued;
int num_resolved;
queue q;
pthread_mutex_t output_lock;
pthread_mutex_t queue_lock;
vo... |
C | #include <stdio.h>
#include <stdlib.h>
// Gustavo Jimenez Torres
//Ejemplo de aplicacion del diseo descendente a un problema \\
//Escribe un programa que dibuje la siguiente piramide utilizando unicamente los simbolos O y X
//usando la salida estandar en modo texto de pantalla. Generaliza el programa para una pirami... |
C | /*H*
*
* FILENAME: exception.c
* DESCRIPTION: Functions for throwing Herbrand errors
* AUTHORS: José Antonio Riaza Valverde
* UPDATED: 16.11.2019
*
*H*/
#include "exception.h"
/**
*
* This function generates an instantiation error returning a
* pointer to a newly initialized Term struct.
*
**/
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<pthread.h>
#include<math.h>
long int fatorial(long int arg){
long long int resposta = 1;
for(int i = 1;i<=arg;i++){
resposta *=i;
}
return resposta;
}
int main(void){
printf("fatorial:%ld\n",fatorial(10));
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <limits.h>
struct Edge{
int y;//end point
int c;//capacity
int f;//flow
struct Edge *next;
};//C type for edge
typedef struct Edge edge;
struct Vertex{
int x;//id
int n;//need
edge *p;
};//C type for verte... |
C | /* Adjecancy list using array of linked list */
#include <stdio.h>
#include <stdlib.h>
struct node{
int info;
struct node *next;
};
typedef struct node NODE;
NODE *first_edge(NODE *start[], int a, int b)
{
NODE *tmp;
tmp = (NODE *)malloc(sizeof(NODE));
tmp -> info = b;
tmp -> next = start[a];
start[a] = tmp... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrev.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
typedef struct wrongAns{ //Structure containing wrong answers and relative operations
char *ans[100];
}wrongAns;
wrongAns wAns[10];
float findTotal(int n, float* operands, int* operators); //function that computes the total
char findOp(int m); ... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(){
char *s;
printf("enter the string : ");
scanf("%s",s);
printf("you entered %s\n", s);
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
int ex8()
{
int i,j;
char *str[13] = {"ab","cd","ef","gh","ij","kl","mn","op","qr","st","uv","wx","yz"};
for (i = 0; i <= 12; i++)
{
for (j = 0; j <= 1; j++)
{
printf(" *str=%p\n", (*(str + i) + j));
printf(" **str=%c\n", *(*(str + i) + j));
}
}
} |
C | #ifndef AOC2020_H
#define AOC2020_H
#define INPUT_NULL_CHECK \
if(input == NULL) \
{ \
printf("Error: Could not read file.\n"); \
} \
size_t removeDupes(void * array, size_t arraySi... |
C | /*
Function to calculate the neighbour j of the k site given a
square lattice of side L and size N (N = L*L).
The neighbours are chosen by the j value as especified below:
j = 0 right neighbour;
j = 1 upper neighbour;
j = 2 left neighbour;
j = 3 below neighbour;
*/
int nbr(int j, int k, int L)
{
int... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
bool check(char c)
{
return ('A' <= c && c <= 'Z') ||
('a' <= c && c <= 'z');
}
int main(int argc, char *argv[])
{
int count = 0;
bool current = false;
char c;
while ((c = getchar()) != EOF) {
if (c == '\n') {
... |
C | /*
** blit_tektext.c for in /home/tek/rendu/gfx_tekgui
**
** Made by
** Login <tek@epitech.net>
**
** Started on Sat Feb 27 08:53:16 2016
** Last update Sat Feb 27 08:53:37 2016
*/
#include "tekgui.h"
unsigned int get_pixel(t_bunny_pixelarray *buffer,
int x,
... |
C | #include <LPC214x.h>
unsigned long int x=0x00000000;
int main(){
unsigned int i=0;
unsigned int j=0;
PINSEL1=0x00000000;
IO0DIR=0x00FF0000;
while(1)
{
//Increasing ramp
for(i=0;i!=0xFF;i++){ //Loop between min value and max value(0xFF)
x=i; // 8 bit to 32 bit conversion
x=x... |
C | /*RESULTS.c
* **USES RESULTS.h
*
* BRIEF:
* Source file for initializing and accessing
* a structure --- USED TO STORE TIME AND SCORE
*/
#include <stdio.h>
#include <stdlib.h>
#include "RESULTS.h"
#include "string.h"
//initializes time and score array elements to 0 and returns the structure... |
C | //program which accept directory name and file name from user and check whether that file is present in that directory or not
/*
Write a program which accept directory name and file name from user and check whether that file is available in that directory or not.
*/
#include <sys/types.h>
#include <dirent.h>
#includ... |
C | #include "mips_interpreter.h"
// runs through all MIPS commands inside a string
void run_from_string(mips_state* registers, char* input)
{
// infinite loop- until we run out of commands to process.
while (input != NULL)
{
// first, skip all whitespace before the next command
input = skip_ov... |
C | #pragma once
#include "polyNTT.h"
struct FactorialNTT {
// High order first
static vector<int> multiplySlow(const vector<int>& left, const vector<int>& right, int mod) {
vector<int> res(left.size() + right.size() - 1);
for (int i = 0; i < int(right.size()); i++) {
for (int j = 0; ... |
C | #include <stdio.h>
int main(void)
{
int cup, ounce, tablespoon, teaspoon;
float pint;
printf("Enter the number of cups: ");
scanf("%d", &cup);
pint = cup / 2.0;
ounce = cup * 8;
tablespoon = ounce * 2;
teaspoon = tablespoon * 3;
printf("%d cups... |
C | /*
Parallel and Distributed Computing Class
OpenMP
Practice 6 : Matrix * Matrix
Name : Obed N Munoz
*/
#include <stdio.h>
#include <omp.h>
#define ROWS_A 200
#define ROWS_B 200
#define COLS_A 200
#define COLS_B 200
int main ()
{
// Counters
int i, j, k;
float sum;
// Working matrix and vectors
flo... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
//Server includes
#include <sys/socket.h>
#include <netinet/in.h>
//HTML parsing library
//#include "gumbo.h"
#include <sys/stat.h>
//connection port
#define PORT 8080
#define IP "127.0.0.1"
static void read_file(FILE *fp, char **output... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdarg.h>
#include "instructions.h"
#include "stack.h"
#include "table.h"
// "Private" methods to break up our work here.
static void readInstructions(FILE * fp);
static void discardline(FILE * fp);
static void e... |
C | #ifndef MOD_INVERSE_ALG_IMPORTED
#include "extended_grade_common_devider_alg.h"
#define MOD_INVERSE_ALG_IMPORTED
// Function to find modulo inverse of a
int mod_inverse(int a, int m)
{
int x, y;
int g = ext_gcd(a, m, &x, &y);
if (g != 1)
return -1; // Error: it`s impossible to find inverse va... |
C | #include <stdio.h>
/**
* main -Entry point
* Descripcion:
* Return: 0
*/
int main(void)
{
int i;
long int na = 0;
long int ne = 1;
long int fibo;
for (i = 0; i < 50; i++)
{
fibo = ne + na;
na = ne;
ne = fibo;
if (i != 49)
{
printf("%ld, ", fibo);
}
else
{
printf("%ld\n", fibo);
}
}
... |
C | /**
******************************************************************************
* main.c
* Matt Saiki
* Session 6 - Morse Code Headlight
*
******************************************************************************
*/
#include "comp494.h"
#include "gpio.h"
#include "morse.h"
#define DLY_CNT_TICK... |
C | #include <stdio.h>
#include <stdlib.h>
int tribonacci(int number){
if (number == 0 || number == 1)
return 0;
if (number == 2)
return 1;
return tribonacci(number -1) + tribonacci(number - 2) + tribonacci(number - 3);
}
int main(){
printf("%d", tribonacci(8));
return 0;
} |
C | #include<stdio.h>
int main(){
int i,j;
for(i=1;i<=4;i++){
char a='A';
for(j=1;j<=7;j++){
if(j>=5-i+1 && j<=2+i){
printf(" ");
if(j==4)
a--;
}else{
printf("%c",a);
j<4?a++:a--;
... |
C | /* cbits
* $ gcc -fPIC -shared cbits.c -o cbits.so
* $ clang -fPIC -shared cbits.c -o cbits.so
* */
#include "stdio.h"
double printPretty(double x) {
putchar((char) x);
fflush(stdout);
return 0;
}
|
C | #include "checkend.h"
int checkend(int diff)
{
int i = 0;
int j = 0;
int sumend = 0;
for(i=1;i<heigh+1;i+=1)
{
for(j=1;j<width+1;j+=1)
{
sumend += ntable[i][j];
}
}
if((500-diff)==sumend)
return 1;
else return 0;
}
|
C | #include "sh.h"
t_token *get_last_token(t_token *t)
{
t_token *r;
r = t;
while (r->next != NULL)
r = r->next;
return (r);
}
int right_row(t_token *t)
{
t_token *first;
first = t;
while (first->next)
{
if (first->type == first->next->type)
return (0);
first = first->next;
}
return (1);
... |
C | // move forwards or backwards
if ((keyDown[38]) || (keyPress[38]))
upArrowKeyPressed = TRUE;
if ((keyDown[40]) || (keyPress[40]))
downArrowKeyPressed = TRUE;
if ((keyUp[38]) && (!keyPress[38]))
upArrowKeyPressed = FALSE;
if ((keyUp[40]) && (!keyPress[40]))
downArrowKeyPressed = FALSE;
if ((upArrowKey... |
C | /*-------------------------------------------------------
ԶİʱȡĿͼFFT㷨
ܣԶгȲ2Ĵݵĩβ0Ϊ2Ĵݵijȣ
ȻʹðʱȡDITĿͼFFT㷨DFT任
أźŴ
ʱ䣺2014-12-05
ģ2014-12-27 ӳģ
-------------------------------------------------------
ģ飺
1帴ĽṹӺ
2
2.1
2.2ı䳤ȣʹ֮2ĴݣIJ
2.3ʼ任
2.4ַ,λ
2.5
2.6
3Ӻ
2.1
2.2
2.3ʼ任
2.4ַ,λ
2.5
2... |
C | #include <stdio.h>
#include <cs50.h>
int main(void)
{
char x = 'a';
char y = 'z';
char z = 'A';
char u = 'Z';
printf("%i, %i, %i, %i", x,y,z,u);
string s = "HELLO";
printf("%c", s[1]);
} |
C | #include<stdio.h>
#include<stdlib.h>
int main(){
int n,h,m,s,i,dia[2],hora[2],minuto[2],segundo[2];
char li[3],xo[3];
printf("Dia ");
scanf("%d",&n);
scanf("%d%s%d%s%d\n",&h,&li,&m,&xo,&s);
dia[0]=n;
hora[0]=h;
minuto[0]=m;
segundo[0]=s;
printf("Dia ");
scanf("%d",&n);
scan... |
C | #include <poll.h>
#include <stdio.h>
static void choose(int *po1, int *po2)
{
struct pollfd as[2];
as[0].fd = *po1;
as[0].events = POLLIN;
as[1].fd = *po2;
as[1].events = POLLIN;
if (poll(as, 2, 5*1000) < 0)
perror("poll");
if ((as[0].revents&POLLIN) == 0)
*po1 = -... |
C | /*********************************
Description:
**********************************/
#include <stdio.h>
#include <errno.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <string.h>
#include <signal.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/shm.h>
#include <time.h>
#include "messa... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int root(int n)
{
return (int)sqrt((float)n);
}
void f_Prime6(int n)
{
int i = 0;
int j = 0;
int k = 0;
int count = 0;
int*p = (int*)malloc(sizeof(int)*(n + 1));
// ʼÿһԪض1
for (i = 0; i < n + 1; i++)
{
p[i] = 1;
}
//printf("prime... |
C | #include<stdio.h>
#include<stdlib.h>
#include<Windows.h>
#include<string.h>
#include<stdarg.h>
BOOL create_child_process(const char *cmd_str, const char* current_directory);
BOOL load_config(const char* path, char* command, size_t size);
void Error(const char* error_str);
void basename(const char *path, cha... |
C | #include<stdio.h>
int main()
{
int a = 545;
// print value and size of an int variable
printf("int a value: %d and size: %lu bytes\n", a, sizeof(a));
char c = 'a';
//print value and size of an char variable
printf("char c value: %c and size %lu bytes\n", c, sizeof(c));
float f = 1.11;
//print value and size... |
C | #include <cs50.h>
#include <stdio.h>
int main(void)
{
void swap(int *a, int *b);
int x = 1;
int y = 2;
printf("Unswapped : %i is x and %i is y\n",x,y);
swap(&x, &y);
printf("Swapped : %i is x and %i is y\n",x,y);
}
void swap(int *a, int *b)
{
printf("Unswapped : %i is ... |
C | #include "buffer.h"
void rs_buffer_init(RSBuffer *buf, long len, double fill)
{
int i;
buf->ptr = ALLOC_N(double, len);
buf->len = len;
buf->offset = 0;
for (i=0; i<len; i++) {
buf->ptr[i] = fill;
}
}
void rs_buffer_resize(RSBuffer *buf, long len)
{
long i;
long old_len = b... |
C | /*
* PeerChat - a simple linux commandline Client - client chat
* Author: Tarun kumar yadav
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdbool.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <pthread.h>
#include ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
void randnum (int *array11)
{
srand (time (0));
for (int i = 0; i < 25; i++)
{
array11[i] = rand () % 100;
}
for (int f = 0; f < 25; f++)
{
printf ("%d ", array11[f]);
}
}
void reverse (int *array22)
{
int cache = 0;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Elemento{
int indice;
int d;
}Elemento;
typedef struct Heap{
struct Elemento *array;
int tamanho;
}Heap;
int parent(int i);
int left(int i);
void heap_decrease_key(Heap *heap, int indice, int key);
int right(int i);
Heap* inicializa_hea... |
C | #include <stdio.h>
// Patrick Korianski Homework 1
// All print statements other than the bottom one that shows the final result, were used for testing and seeing the correct number of steps per trial.
int main()
{
int a, b, x, final, lgsteps;
lgsteps = 0;
printf( "Enter a: ");
scanf("%d", &a);
printf( "En... |
C | #include <stdio.h>
#include <stdlib.h>
#include "holberton.h"
/**
* _calloc - reallocates a memory block using malloc and free.
* @ptr: pointer
* @old_size: size of ptr
* @new_size: new size of memory block.
* Return: s
**/
void *_realloc(void *ptr, unsigned int old_size, unsigned int new_size)
{
void *p;
if (... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_characters.c :+: :+: :+: ... |
C |
#ifndef _UTIL_LIST_H_
#define _UTIL_LIST_H_ 1
#include <stdlib.h>
#include <memory.h>
#include "private/list.h"
static struct list_node* new_list_node(void *val, size_t val_t)
{
const size_t mem_t = sizeof(struct list_node) + val_t;
struct list_node *node = (struct list_node*) malloc(mem_t);
if (node ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* init_fractals.c :+: :+: :+: ... |
C | #ifndef PARSER_UTIL
#define PARSER_UTIL
#include "bool.h"
#include "util.h"
#include "context.h"
typedef enum{
UNKNOWN,
STRING,
NO_TYPE
} token_type;
typedef struct{
char *string;
token_type type;
char last_char;
} token_t;
bool token_init(token_t *this, const char *string, token_type type,... |
C | #include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#include "my_ls.h"
#include <ctype.h>
#include <pwd.h>
#include <grp.h>
#include <time.h>
#define STRMAX 1024
char * compare_mode(char c){
switch(c){
case '0':
return (c... |
C | int
futex_wait(struct futex * f, int val, struct timespec * reltime) {
ret = 0;
Mark process as INTERRUPTIBLE
Hash ("struct page *" + offset) -> index [i] into hash table
chain "struct futex_q" to tail of hashtable[i]
typedef struct futex_q {
process * prptr;
struct... |
C | #include <stdio.h>
#include <stdlib.h>
#include<math.h>
int main()
{
int i;double s;double p;double a[4];
int flag=0;
a[3]=0;
for(i=0;i<=2;i++)
printf("α߳:"),scanf("%lf",&a[i]),a[3]+=a[i];
p=a[3]/2.0;
for(i=0;i<=2;i++)
if(a[3]>2*a[i])flag++;
if(flag==3) s=sqrt(p*(p-a[0... |
C | #define _XOPEN_SOURCE 700
#define _DEFAULT_SOURCE
#include<stdio.h>
#include<stdlib.h>
#include <string.h>
#include <time.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include <limits.h>
#include <unistd.h>
#include <time.h>
#include <ftw.h>
// format daty którą podajemy w ar... |
C | //
// Created by black.dragon74 on 4/23/18.
// Code is poetry.
//
#include <stdio.h>
// A void method that simply prints an empty line using the escape character "\n"
void printEmptyLine(){
printf("\n");
}
int main() {
int* ptest; // A pointer that will point to the address of a variable of type int
i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
pthread_t tid1 , tid2;
pthread_mutex_t g_mutex1 = PTHREAD_MUTEX_INITIALIZER
, g_mutex2 = PTHREAD_MUTEX_INITIALIZER;
void *ret1;
void *ret2;
void* thread1(void *x)
{
//deadlock
/*
pthread_mutex_lock(&g_mu... |
C |
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <string.h>
#include "jobs.h"
typedef struct job_node {
pid_t pid;
char* display_name;
job_node* next;
job_node* prev;
} job_node;
job_node* job_create(pid_t pid, char* name) {
job_node* new_job = malloc(... |
C | /**
* @file
* Implementation of the SPSPS library.
*
* @verbatim
* SPSPS
* Stacy's Pathetically Simple Parsing System
* https://github.com/sprowell/spsps
*
* Copyright (c) 2014, Stacy Prowell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are p... |
C | // simple.c
// Drew Bies
// project 2
// CPSC 346 02
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/slab.h>
typedef struct person
{
int month;
int day;
int year;
struct person *next;
} node;
node* pptr;
// makes node with head ptr
void make... |
C | #include "utilities.h"
const int mounthLUTny[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; // days in non leap year
const int mounthLUTly[] = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 }; // days in leap year
const int mounthDays[] = { 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct node Node;
typedef int boolean;
#define true 1
#define false 2
struct node{
int data;
struct node *next;
}; //structure to node
void deleteNode(Node *node){ free(node); } //free the memory location of a node
Node* createNewNode(int value){
Node *node = (Node*)... |
C | /***************************************************************************************************
ExploreEmbedded
****************************************************************************************************
* File: eeprom.c
* Version: 15.0
* Author: ExploreEmbedde... |
C | #include <cs50.h>
#include <stdio.h>
int get_positive_int(string message, int minimum, int max);
int main(void)
{
int minimum = 1;
int max = 8;
int height = get_positive_int("Write a number from %i to %i: ", 1, 8);
for (int i = 1; i <= height; i++)
{
for (int j = 1; j <= height; j++)
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "tela.h"
#include "linhas.h"
#define MALLOC(x) ((x *) malloc (sizeof(x)))
/***********************************************************************************************************************************/
/***********************************************************... |
C | #include "sudoku.h"
#include <stdio.h>
#include <stdlib.h>
Position* fromGrid(char grid[9][9])
{
int i,j; //za setanje po matrici
Position *mySudoku = (Position*)malloc(sizeof(Position)); //alociraj mem oblika strukture Position (predstavlja sudoku)
mySudoku->load=0;
for (i=0;i<9;i++)
{... |
C | #include "monty.h"
/**
* add - function that adds the top two elements of the stack.
* @stack: top pointer of a doubly linked list.
* @line_number: number of line in file where we found the command.
* Return: nothing.
*/
void add(stack_t **stack, unsigned int line_number)
{
stack_t *aux1 = *stack;
(void) line_... |
C | #include "Position.h"
#include "Error.h"
#include <stdlib.h>
#include <assert.h>
Component_Type POSITION_COMPONENT = "Position";
struct Position
{
Component info;
double x, y;
};
Position* Position_create(double x, double y)
{
Position* self = malloc(sizeof(Position));
if(!self)
error(ERROR_ALLOC);
self->inf... |
C | #include "csapp.h"
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
int main()
{
pid_t pid = fork();
if (pid == 0)
printf("\n Hi from the child - my pid = %d \n", pid);
else
printf("hello from parent - pid = %d \n", pid);
return 0;
}
|
C | //
// main.c
// Exercise 3
//
// Created by Changheng Chen on 11/17/16.
// Copyright © 2016 Changheng Chen. All rights reserved.
//
/* Predict what will be printed on the screen */
#include <stdio.h>
#define PRD(a) printf("%d", (a) ) // Print decimal
#define NL printf("\n"); // Print new line
// Create and init... |
C | #include "lists.h"
#include <stdlib.h>
/**
* delete_dnodeint_at_index - inserts a node at position
* @h: double pointer to the head
* @index: index to insert new node
* Return: 1 or - 1
*/
int delete_dnodeint_at_index(dlistint_t **h, unsigned int index)
{
dlistint_t *temp = NULL;
unsigned int i = 0;
if (!h |... |
C | /*
Johannes Schneemann
November 26, 2019
*****************************************************
This C program compares the performance of the LRU
and the Optimal page replacement algorithms.
*****************************************************
Description:
The program will take a reference string and the n... |
C | #include <stdio.h>
int fun(int n)
{
if (n == 2 || n == 3)
return 1;
if (n == 1)
return 0;
else
return fun (n - 2) + fun(n - 3);
}
int main()
{
int n;
//int sum = 0;
while (scanf("%d", &n) != EOF) {
printf("%d\n", fun(n));
}
return 0;
}
|
C | /*
** calc_k.c for raytracer in /home/cheval_y//raytracer/sources/intersection
**
** Made by franck chevallier
** Login <cheval_y@epitech.net>
**
** Started on Thu Apr 11 11:18:04 2013 franck chevallier
** Last update Fri Jun 7 18:16:04 2013 antoine simon
*/
#include "raytracer.h"
int calc_k(t_discriminant disc... |
C | #include <stdio.h>
#include <stdlib.h>
/* Dados trs nmeros verificar se eles podem representar as medidas dos lados de um
tringulo e, se puderem, classificar o tringulo em equiltero, issceles ou escaleno.
Para codificar o programa, devemos lembrar das seguintes definies:
Para que trs nmeros representem os lados d... |
C | #include "main.h"
#include "arg.h"
/********************************************************************/
/* */
/* ALTERNATYWNA DO PRZEDSTAWIONEJ NA WYKLADZIE WERSJA OPRACOWANIA */
/* PARAMETROW WYWOLANIA PROGRAMU UWZGLEDNIAJACA OPCJE Z PARAMETRAMI */
... |
C | /* print a table of squares and cubes */
#include <stdio.h>
double square(double);
double cube(double);
int main(void)
{
int how_many = 0 , i, j;
printf("I want square and cube for 1 to n where n is: ");
scanf("%d", &how_many);
printf("\n square and cubes by interval of .1\n");
for (i=1; i <= ho... |
C | // base2.c
#include <stdlib.h>
#include <stdio.h>
#include "quack.h"
#include <ctype.h>
int check_valid_input(char * x){
fputs("checking if the input is a number...\n", stdout);
while(*x){
printf("%c", *x);
if (!isdigit(*x)){
fprintf(stderr, "\nnot all input are digits!\n");
exit(EXIT_FAILURE);
}
put... |
C | #include "func.h"
int Cd(char* buf)//进入相对应的目录
{
//printf("cd: %s\n",buf);
char func[100]={0};
int i=2,j=0;
while(buf[i]!='\0')
{
if(buf[i]!=' ') func[j++]=buf[i];
i++;
}
func[j]='\0';
//printf("func=%s\n",func);
if(strcmp(main_pwd,getcwd(NULL,0))==0)
{
if(strcmp(func,"..")==0)
{
printf("cd error\... |
C | #include <stdio.h>
#include <stdlib.h>
#include "generationCode.h"
// Création fonction choix
void choix (int Num)
{
// Création du fichier param.h
FILE *fichier = NULL;
fichier = fopen("coeur\\param.h", "w+");
// Retourner la valeur saisie dans le fichier créé
fprintf(fichier, "i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.