language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "ata_pio.h"
#include "../screen.h"
#include "../../fonts/font_desc.h"
#include "../../fonts/font_basic.h"
extern struct font_desc ft_basic;
uint16_t ATA_PIO_bl_common(uint16_t drive, uint64_t numblock, uint16_t count, bool LBA48)
{
if (LBA48) {
outb(0x1F6, 0x40 | ((drive % 2) << 4));
for ... |
C | /*
color.c - Eine neue Farbe einrichten
*/
# include <stdio.h>
# include <xview/frame.h>
# include <xview/panel.h>
# include <xview/cms.h>
void quit_proc(Panel_item item, Event *event)
{
xv_destroy_safe(xv_get(item, PANEL_CLIENT_DATA));
return;
}
int main(int argc, char *argv[])
{
Frame frame;
Panel p... |
C | // compile with
// gcc -o SHM_TEST_set SHM_TEST_set.c -lrt
// run fuzzilli patched javascript engine with environmentvariable SHM_ID=/SHM_TEST
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#define STORAGE_ID "/SHM_TEST"
#de... |
C | #include "link_list.h"
#include <string.h>
#include <stdlib.h>
typedef struct {
LinkListNode header;
size_t length;
}TLinkList;
// ʵ˼еʵֲַܴ
// ֻmallocһTlinkLiskýṹ
// Ϣһijȣһͷڵ㡣ע
// ͷڵָ룬ôʹõʱҪΪͷڵָڴ䡣
// ͷڵ㣬ͷڵָLinkListNodeڵ㣬ÿڵ㶼
// ҵڵڴģԲøжڴͷš
// һߴ飬ÿҵڵϣҪһϡ
LinkList* LinkList_Create() {
TLinkList* tlist = (TLinkList*... |
C | /******************************************
* ____ ____ ____ ____ _____ *
* |_ \ / _| |_ _||_ _| |_ _| *
* | \/ | \ \ / / | | *
* | |\ /| | > `' < | | _ *
* _| |_\/_| |_ _/ /'`\ \_ _| |__/ | *
* |_____||_____| |____||____| |________| *
* ... |
C | void delall(struct node **head){
struct node *temp2=*head;
struct node *temp1;
temp1 = (*head);
while(temp1!=NULL) // as I am considering tail->next = NULL
{
(*head)->next = temp1->next;
temp1->next = NULL;
free(temp1);
temp1 = (*head)->next;
}
*head=temp2->next;
}
|
C | /*
* Build: cc timewindow.c -o timewindow
* Run ./timewindow <Y> <Z> <TU>
*/
#include <stdio.h>
#include <stdlib.h>
double TW_Optimize(unsigned short Y, unsigned short Z, double TU)
{
return (((1 << Y) * (4 + Z)) >> 2) * TU;
}
double TW_Manufacturer(unsigned short Y, unsigned short Z, double TU)
{
return (1 << Y)... |
C | #include<stdio.h>
#include<conio.h>
void swap(int *x, int *y)
{
int temp = *x;
*x = *y;
*y = temp;
}
void selectionSort(int arr[], int n)
{
int i, j, min;
for (i = 0; i < n-1; i++)
{
min = i;
for (j = i+1; j < n; j++)
if (arr[j] < arr[min])
min = j;
swap(&arr[min], &arr[i]);
}
}
voi... |
C | /*
* microswitch.c
*
* Created on: 2019/09/09
* Author: tomok
*/
#include "microswitch.h"
/*
* SẴ}CNXCb`ׂ
* @param
* @return SWITCH_ON/SWITCH_OFF
*/
/*
* }CNXCb`ON/OFFԂ
* @param switch_num : {^̔ԍ
* @return MICROSW_ON / MICROSW_OFF
*/
uint8_t MicroSwitchIsOn(uint8_t switch_num) {
#ifdef MICROSW... |
C | #include "covidTrace.h"
struct timeval tic(){
struct timeval tv;
gettimeofday(&tv, NULL);
return tv;
}
double toc(struct timeval begin){
struct timeval end;
gettimeofday(&end, NULL);
double stime = ((double)(end.tv_sec - begin.tv_sec) * 1000) +
((double)(end.tv_usec - begin... |
C | #include <iostream>
int main()
{
int ival = 1024;
int &refVal = ival; // ok: refVal refers to iVal
// int &refVal2; // error: a reference must be initialized
// int &refVVal3 = 10; // error: initializer must be an object
refVal += 2;
int ii = refVal;
std::cout << ii << ival << std::endl;
}
|
C | #include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
/*
题目:删除有序数组中的重复项
给你一个有序数组 nums ,请你 原地 删除重复出现的元素,使每个元素 只出现一次 ,返回删除后数组的新长度。
不要使用额外的数组空间,你必须在 原地 修改输入数组 并在使用 O(1) 额外空间的条件下完成。
提示:
0 <= nums.length <= 3 * 104
-104 <= nums[i] <= 104
nums 已按升序排列
说明:
为什么返回数值是整数,但输出的答案是数组呢?
请注意,输入数组是以「引用」方式传递的,这意味着在函数里修改输入数组对于调用者... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* realloc.c :+: :+: :+: ... |
C | /**
package . a.b ;
//@
/*@*\/
import
#@
namespace
{}
final eq=block
"@" '@'
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#ifndef bool
#define bool int
#define false 0
#define true 1
#endif
#define CHARBUFSIZE 1024
#define INPUTBUFSIZE 16
//Ͷ
struct String;
typedef struct String String;
struct Token;
... |
C | //#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
//
//int main()
//{
// double sum = 0;
// for (int i = 0; i < 100; ++i) {
// sum += 1.0 * pow(-1,i) / (i + 1);
// }
// printf("%lf\n",sum);
// system("pause");
// return 0;
//} |
C | #include <stdint.h>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include "gamma.h"
#include <stdbool.h>
#include <string.h>
int main() {
/*
scenario: test_random_actions
uuid: 331177775
*/
/*
random actions, total chaos
*/
gamma_t* board = gamma_new(6, 7, 9, 8);
assert( board != NULL );
assert( gamm... |
C | #include "lists.h"
/**
* sum_listint - Returns the sum of all data of a listint_t list
* @head: pointer to head node.
* Return: Sum of all data, 0 if the list is empty.
*/
int sum_listint(listint_t *head)
{
listint_t *tmp;
int sum = 0;
if (head == NULL)
return (sum);
tmp = head;
while (tmp != NULL)
sum... |
C | #include "../Includes/Tools.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
struct line
{
char *line;
}c;
struct tab
{
char tab[100][100];
}t;
struct prio
{
int prio;
}p;
void my_getnextline()
{
FILE *fp;
size_t len = 0;
ssize_t read;
read = getline(&c.line, &len, std... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/wait.h>
#include <stdlib.h>
int main() {
int i, shmID, *shared_mem, count=0, total=0,rnd;
shmID = shmget(IPC_PRIVATE, sizeof(int), IPC_CREAT | 0644);
// shmget() returns the identifier of the System V shared memory ... |
C | #include "I2C.h"
/****************************
* @param none
* @author Unicorn
* @date 2017-12-21
*/
/*******************************************************************************
* @function : start
* @brief : starting the I2C bus and notifying all I2C device
* @param :... |
C | #include<stdio.h>
int main()
{
int a,b,c;
printf("Enter the no");
scanf("%d,%d,%d",&a,&b,&c);
if(a>=b)
{
if(a>=c)
{
printf("%d is largest",a);
}
else
{
printf("%d is largest",c);
}
}
else
{
if(b>=c)
{
printf("%d is largest",b);
}
else
{
printf("%d is largest",c);
}
return 0;
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
int main(int argc, char *argv[])
{
void* handle;
double (*func)(double);
char* error;
if (argc <= 1) {
fprintf(stderr, "argument error\n");
return EXIT_FAILURE;
}
handle = dlopen(argv[1], RTLD_NOW);
if (handle == NULL... |
C | /*************************************************************************************
* Copyright (c) 2019 Xiaoyang Xu, Masoud Ghaffarinia, Wenhao Wang, and Kevin Hamlen *
* The University of Texas at Dallas *
* Copyright (c) 2020 Aalto University Secure Systems Group... |
C | #include <cwalk.h>
#include <memory.h>
#include <stdlib.h>
int dirname_relative()
{
const char *path;
size_t length;
cwk_path_set_style(CWK_STYLE_UNIX);
path = "../one/two.txt";
cwk_path_get_dirname(path, &length);
if (length != 7) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
int dirname_thr... |
C | #include <stdio.h>
int addsub(int int1[],int int2[],int flag){
int ret[5],int3[5],int4[5];
int count=4;
int num=0;
int i,j,k;
int ZF=1,SF=0,CF=0,OF=0;
if(flag==0){
int3[0]=0;int4[0]=0;
for(i=1;i<5;i++){
int3[i]=int1[i-1];
int4[i]=int2[i-1];
}
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
#include <ctype.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/mman.h>
#include "SaveScratchToFile.h"
#include "omapl138_gpiofuncs.h"
#include "../../s... |
C | #include <stdio.h>
#include <stdlib.h>
struct node { //Linked List here using Structures
int value;
struct node *next;
};
void traverse(struct node* mylist) {
struct node* t1 = mylist;
while (t1 != NULL) {
printf("%d --> ", t1->value);
t1 = t1->next;
}
return;
}
void cleanup(struct node* mylist) {
str... |
C | #include <stdio.h>
#include <stdlib.h>
int main(void) {
int nbNames = 5, i = 0;
char *nameList[] = {"MOUNIER Adrien", "MAX Jorgan", "CHAIZEMARTIN Vivian", "CHERRIER-VALENTIN Francois", "TRAN Eric"};
printf("%d names to display:\n", nbNames);
for(i = 0; i < nbNames; i++)
printf("%s\n", nameList[i]);
re... |
C | /**********************************************************************************************
*** Filename:
*** test.c
*** Copyright (c) 2013 Wistron
*** All rights reserved.
***
*** Description:
*** Get how many ones in an integer's binary expression.
***
*** Author/Creat Date:
*** Albert Yang, Apri 12,13
***
... |
C | #include <stdio.h>
int main()
{
int count,i;
float total=0,max;
float subject[1010]={0};
scanf("%d", &count);
for(i=0; i<count; i++)
scanf("%f", &subject[i]);
max = subject[0];
for(i=0; i<count; i++)
{
if( max < subject[i+1])
max = subject[i+1];
}
for(i=0; i<count; i++)
total +=... |
C |
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include "otp.h"
#include "mbedtls/md.h"
// #define DEBUG 1
static int DIGITS_POWER[] =
{1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000};
// 默认单向散列算法
mbedtls_md_type_t m_md_type = MBEDTLS_MD_SHA1;
// 生成口令长度
uint8_t m_num = 6;
... |
C | struct student
{
char num[1000];
int age;
struct student *next;
};
struct student *creat(int n)
{
struct student *p1,*p2,*head;
int i;
for (i = 0;i < n;i++)
{
p1 = (struct student*)malloc(len);
scanf("%s%d",p1->num,&p1->age);
p1->next = NULL;
if(i == 0)
{
p2 = p1;
head = p1;
... |
C | #include <stdlib.h>
#include <stdio.h>
int main(void)
{
char c = '\0';
const char file_name[] = "input_files/life_is_funny.txt";
FILE *f_input = NULL;
f_input = fopen(file_name, "r");
if (NULL == f_input)
{
fprintf(stderr, "problème avec l'ouverture du fichier %s\n", file_name);
}... |
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
int main(){
int fd[2];
const char * informacao = "uma mensagem";
char leitura[sizeof informacao];
int pid;
pipe(fd);
pid = fork();
if(pid < 0){
printf("Erro\n");
exit(-1);
}
if(pid > 0){
//pai
waitpid(-1... |
C | ////*Using a mutex to protect access to global variable*//////
/* This program is a modified version of the previous program. It uses a mutex to protect access to the global variable glob. When we run this program with a similar command line to that used earlier, we see the glob is always reliably incremented*/
#includ... |
C | #ifdef __cplusplus
extern "C" {
#endif
struct fz_bbox_s
{
int x0, y0;
int x1, y1;
};
typedef struct fz_bbox_s fz_bbox;
/* Rectangles and bounding boxes */
#define SAFE_INT(f) ((f > INT_MAX) ? INT_MAX : ((f < INT_MIN) ? INT_MIN : (int)f))
/*
fz_is_empty_rect: Check if rectangle is empty.
An empty re... |
C | /*
** EPITECH PROJECT, 2019
** cmd_setenv
** File description:
** setenv
*/
#include "mysh.h"
void check_my_list(char **cmd, infos *inf)
{
element *e = malloc(sizeof(element));
e->next = NULL;
e->var = my_strdup(cmd[1]);
e->prev = NULL;
inf->first = e;
inf->last = e;
inf->first->prev = NU... |
C | #include<stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{
char a[500],c[500],input;
int i,j,l1,l2;
char b[40]="qwertyuiopasdfghjkl;zxcvbnm,./";
scanf("%c %s",&input,&a);
l1=strlen(a);
l2=strlen(b);
if(input=='R')
{
for(i=0; i<l1; i++)
{
for(j=0; j<l2... |
C | //
// memory.c Petri Välisuo, 1.2.2020
//
// A program for testing the memory allocation and memory copy and
// Ceaser encryption.
//
// Compile with
// gcc memory.c -o memory
//
// Example usage
// ./memory koe.txt 2
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Define a constant. This is... |
C | #include <stdio.h>
#include<stdlib.h>
#include "pilha1.h"
#include <locale.h>
void menuPrincipal(pilha *pino1, pilha *pino2, pilha *pino3);
void insereDiscos(pilha *pino1);
int vencedor(pilha *pino3);
int moverDisco(pilha *pino1, pilha *pino2,pilha *pino3);
int MenuJogadas ();
int verificaMovimento(pilha *qu... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* list.c :+: :+: :+: ... |
C | #include<stdio.h>
int arr[50][50];
int main(){
int r,c,i,j,pool=0;
scanf("%d %d",&r,&c);
for(i=0;i<r;i++)
for(j=0;j<c;j++)
scanf("%d",&arr[i][j]);
for(i=1;i<r-1;i++)
for(j=1;j<c-1;j++){
if(arr[i][j]==0){
if(arr[i][j-1]==1 && arr[i-1][j]==1)
pool++;
}
}
printf("%d",pool);
} |
C | /**
* @file
* @brief Time functions.
*
* Functions used to keep doors open for 3 seconds etc.
*/
#include <stdio.h>
#include <stdlib.h>
/**
* @brief Starts a timer that expires after @p msec seconds.
*
* @param msec
*/
void timer_start_timer(int msec);
/**
* @brief Checks if the timer has expired.
*
*... |
C | /*
gcc -std=c17 -lc -lm -pthread -o ../_build/c/numeric_math_isfinite.exe ./c/numeric_math_isfinite.c && (cd ../_build/c/;./numeric_math_isfinite.exe)
https://en.cppreference.com/w/c/numeric/math/isfinite
*/
#include <stdio.h>
#include <math.h>
#include <float.h>
int main(void)
{
printf("isfinite(NAN) = %d\... |
C | /* 배열 출력하기 */
#include <stdio.h>
int main() {
int arr[10] = { 2, 10, 30, 21, 34, 23, 53, 21, 9, 1 };
int i;
int sum = 0;
printf("배열의 바이트 크기%d 배열의 요소 크기%d \n", sizeof(arr), sizeof(arr) / sizeof(int));
printf("오름차순\n");
for (i = 0; i < sizeof(arr) / sizeof(int); i++) {
printf("배열의 %d... |
C | #ifndef MISC_H_
#define MISC_H_
#include <SDL/SDL.h>
// Print an error message on stderr and exit
void error(const char *s, ...);
// Load an image, raise an error in case of failure
SDL_Surface* load_image(const char *filename);
// Return a random number between a and b (a must be lesser than b)
int ran... |
C | #include <malloc.h>
#include "CircularBuffer.h"
CircularBuffer *circularBufferNew(int length, int sizeOfType) {
CircularBuffer *cb = malloc(sizeof(CircularBuffer));
cb->length = length;
cb->size = 0;
cb->sizeOfType = sizeOfType;
cb->head = cb->tail = cb->buffer = malloc(sizeOfType * length);
return cb;
}
void ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <semaphore.h>
#define CLOCKWISE 0
#define COUNTERCLOCKWISE 1
int nT, nS;
typedef struct {
pthread_mutex_t clockwise;
pthread_mutex_t counterclockwise;
} Station;
typedef struct {
int id;
int direction;
int id_station;
} Train;
typedef struct... |
C | /***************************************************************************************/
/* Name : Linkedlist_traversal.c */
/* Author : Srinikethan Mankala */
/* Date : 2019-02-14 1... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]){
int vetor[8];
for(int j = 0; j < 8; j++){
scanf("%d", &vetor[j]);
}
int x, y;
scanf("%d", &x);
while(1){
if(x >= 0 && x <= 8){
break;
}else{
printf("Valor de X invalido!\n");... |
C | #include <stdlib.h>
#include <stdio.h>
int ft_strlen(char *s)
{
int i = 0;
while (*s++)
i++;
return i;
}
char *ft_strrev(char *s)
{
int tmp;
int i = 0;
int l = ft_strlen(s);
while (l > i)
{
l--;
tmp = s[i];
s[i] = s[l];
s[l] = tmp;
i++;
}
return s;
}
char ft_six(int a)
{
if (a >= 10)
return (a... |
C | #include <stdio.h>
#include <stdlib.h>
#include "display.h"
void display(int** matrix, int size){
for (int i=0; i<size; i++){
for (int j=0; j<size; j++){
printf("%4i ", matrix[i][j]);
}
printf("\n");
}
}
|
C | #include <math.h>
#include "../image.h"
typedef float(*interpolate_fun)(image, float, float, int);
image resize(image im, int w, int h, interpolate_fun f) {
image new_im = make_image(w, h, im.c);
float row, col, chan;
for (chan = 0; chan < im.c; chan++) {
for (row = 0; row < h; row++) {
... |
C | #include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
int main(int argc, char *argv[])
{
int fd, led, web, LEDret, webRET, n;
int ret = 0;
char rddata[4], str[16];
char stringbuffer[100];
fd = open("/dev/i2c-1", O_RDWR);
led = open("/sys/class/g... |
C | #include <stdio.h>
#include <math.h>
#define PI 3.1415926358979323
#define RAD PI/3
typedef struct{
double x,y;
}point;
int n;
void kochcurve(point,point,int);
int main()
{
point start,end;
start.x=0,end.x=100;
start.y=end.y=0;
scanf("%d",&n);
printf("%.8f %.8f\n",start.x,start.y);
kochcurve(start,end,n);
print... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <errno.h>
long read_num(char *str)
{
long v;
char *p;
errno = 0;
v = strtol(str, &p, 0);
if (errno != 0 || *p != '\0') {
fprintf(stderr, "Invalid value '%s'\... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
int main()
{
pid_t pid;
int x =0;
for (int i =0; i <3; i++)
if((pid=fork())==0) // child process
break;
if (pid!=0) // parent process
for (int i=0;i<3;i++)
wait(NULL);
x++;
printf("x = %d\n",x);
return 0;
}
|
C | //һѧ(sse汾)
inline void prodm_general( const float b[16],const float a[16],float r[16])//ra,b֮һ
{
__asm{
mov esi,b //b[i]=[esi+04h*i]
mov edx,a //a[i]=[edx+04h*i]
//xmm0~xmm3b
movups xmm0,[esi]//b[0~3]->xmm0
movups xmm1,[esi+04h*4]//b[4~7]->xmm1
movups xmm2,[esi+04h*8]//b[8~11]->xmm2
movups xmm3,[esi+04h*... |
C | #include <stdio.h>
#define LINE_BUFFER_LENGTH 2222 // cheating
void flush_buffer(char *line_buffer);
void print_buffer(char *line_buffer, int end);
int main(void) {
int c,
i,
line_index,
all_spaces,
last_char_index;
char line_buffer[LINE_BUFFER_LENGTH];
all_spaces = 1;
... |
C | #include "myStrHead.h"
int myStrlen(char *str){
if(str==NULL)
return 0;
int num = 0;
while(*str){
++num;
++str;
}
return num;
}
|
C | /**********************************************************************
* file: sr_router.c
* date: Mon Feb 18 12:50:42 PST 2002
* Contact: casado@stanford.edu
*
* Description:
*
* This file contains all the functions that interact directly
* with the routing table, as well as the main entry method
* for rou... |
C | /*
** get_int.c for in /home/bertha_e/rendu/Synthse/palindrome/src
**
** Made by Berthaud Elodie
** Login <bertha_e@epitech.net>
**
** Started on Thu Jun 16 11:46:57 2016 Berthaud Elodie
** Last update Fri Jun 17 11:29:20 2016 Berthaud Elodie
*/
#include <stdlib.h>
#include <stdio.h>
#include "palindrome.h"
cha... |
C | #include "vector.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define VECTOR_INIT (8)
static char* _create_string(vector* obj);
/**
* Virtual method table for vector
*/
static struct vector_vmt vmt = {
_create_string
};
/**
* Constructor for vector
*/
vector* vector_init(vector* self,... |
C | /*---------------------------------------------------------------------
nustdif.c
2003.7.27 Tabito Hara
tdif
ǥեȤ,binary ǽ
ץ
-b : binary ǽ(ǥե)
-----------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h> /* for malloc */
#include <string.h>
#include "stringplus.h"
#i... |
C | #include <nodetree.h>
/*
* ARCHIVO:
* NodeTree.c
* �ltima modificaci�n: 2004/07/28 (Marisol Villacres)
* --------------------------------------------------------------------------------------
* DESCRIPCION:
* Este archivo contiene la implementacion de las operaciones
* para el manejo del TDA NodeTre... |
C | #include <stdio.h>
int main()
{
int count = 0;
while (count < 10)
{
printf("Hello world!\n");
count++;
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
long any(const char s1[], const char s2[]);
int main()
{
char s1[] = "kirilla";
char s2[] = "a";
long position = any(s1, s2);
printf("\ns1=%s\ns2=%s\nposition=%d", s1, s2, position);
return 0;
}
long any(const char s1[], const char s2... |
C | #include <stdio.h>
#include <gmp.h>
char *prog;
typedef struct elliptic_curve_t
{
mpz_t A,B,p;
} elliptic_curve;
typedef struct point_t
{
mpz_t x,y;
} point;
void elliptic_curve_init(elliptic_curve* e)
{
mpz_init(e->A);
mpz_init(e->B);
mpz_init(e->p);
}
void point_init(point* p)
{
mpz_init(p->x);
mpz_init(p... |
C | #include <stdio.h>
#include <stdlib.h>
#define true = 1
#define false = 0
#define bool = int
// Initialize variables
int secs, cubed, op, length, height, counter, to;
// Prototyping Functions
int secsNYear();
int cube();
int shapes();
int squarearea();
void evenodd();
void operation();
// Running Programs
int main(){... |
C | /*练习 2-1 编写一个程序以确定分别由signed及unsigned 限定的char、short、
int与long类型变量的取值范围。采用打印标准头文件中的相应值以及直接计算两种方式实
现。后一种方法的实现较困难一些,因为要确定各种浮点类型的取值范围。*/
#include <stdio.h>
#include <limits.h>
#include <float.h>
int main()
{
printf("int(%d ~ %d)\n", INT_MIN, INT_MAX);
printf("int(%d ~ %d)\n", 1<<(sizeof(int)*8-1), ~(1<<(sizeof(int)*8-1)... |
C | /*
writer.c
an implementation of vector/matrix writer.
$Id: writer.c,v 1.3 2004/11/06 09:44:42 dmochiha Exp $
*/
#include <stdio.h>
#include "writer.h"
void
lda_write (FILE *ap, FILE *bp, double *alpha, double **beta,
int nclass, int nlex)
{
printf("writing model..\n"); fflush(stdout);
write_vector(... |
C | #include <stdio.h>
int main() {
char c;
int d;
c = EOF;
d = EOF;
printf("%c %d \n", c, d);
c = ' ';
d = ' ';
printf("%c %d \n", c, d);
c = '\n';
d = '\n';
printf("%c %d \n", c, d);
c = '\t';
d = '\t';
printf("%c %d \n", c, d);
return 0;
} |
C | // (C) Copyright Hans Ewetz 2019. All rights reserved.
#pragma once
#include <stdio.h>
#include <stdlib.h>
// --- combuf struct ---
// (communication controll-buffer between paraloop and sub-processes)
// (buffer is also used as elements in the input queue and output queue)
// (combufs are moved from: 'combufpool --> ... |
C | #include <stdio.h>
int main(void)
{
int size;
// getting input
printf("How many numbers are you going to enter: ");
scanf("%i", &size);
int array[size]; // declaring array
printf("\nEnter the numbers:\t");
for (int i = 0; i < size; i++)
{
scanf("%i", &array... |
C | #include "../includes/minishell.h"
void add_pwd(t_envp **list_envp)
{
t_envp *pwd;
pwd = new_envp("PWD=", NULL);
free(pwd->value);
pwd->value = get_pwd();
if (!*list_envp)
*list_envp = pwd;
else
lastadd_envp(*list_envp, pwd);
}
void add_shlvl(t_envp **list_envp)
{
t_envp *shlvl;
shlvl = new_envp("SHLVL=... |
C | #include "fila.h"
#include <stdio.h>
#include <stdlib.h>
struct lista
{
float info;
struct lista* prox;
};
struct fila
{
Lista* ini;
Lista* fim;
};
Fila* criar_fila()
{
Fila* f = (Fila*)malloc(sizeof(Fila));
f->ini = f->fim = NULL;
return f;
}
void inserir(Fila* f, float v)
{
Lista* novo = (Lista*)malloc(si... |
C | #include <stdio.h>
int main(int argc, const char *argv[]) {
char *a = new char[10];
char *a0 = a + 0;
char *a5 = a + 5;
int *b = new int[10];
int *b0 = b + 0;
int *b5 = b + 5;
int c = (int)b5 - (int)b0; // Emscripten should warn!
int d = (int)b5 - (int)b0; // Emscripten should warn!
printf("*%d*\n"... |
C | #include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node*next;
};
struct node*insertnode(struct node*start , int x)
{
struct node*p = start;
struct node*temp;
temp = (struct node*)malloc(sizeof(struct node));
if(start == NULL)
{
temp->data = x;
... |
C | #include <stdio.h>
#define pi 3.14
float Area(float r)
{
float a = pi * r * r;
return a;
}
int main()
{
float area, radius;
int n, i;
char c;
printf("How many circles?\n");
scanf("%d", &n);
for (i = 1; i <= n; ++i)
{
printf("\nCircle no : %d\nRadius = ? ", i);
scanf("... |
C | #include <stdio.h>
int maini( ) {
int a, b;
scanf( "%d %d", &a, &b );
if ( a >= b ) {
printf( "%d\n", a );
}
else {
printf( "%d\n", b );
}
return 0;
}
|
C | //Andrey Khoroshavin BS9_02
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
size_t getsize(void * p) {
size_t * in = p;
if (in) { --in; return *in; }
return -1;
}
void* my_realloc(void* ptr, size_t size){
void* new;
if (ptr == NULL){
//no pointer got -> create new
new... |
C | /*
Student Name:Sunita Gosai
Subject:Programming Fundamental
Lab Sheet No:04
Program:WAP to print area of trapezium of triangle
Date:21 Nov 2016
*/
#include<stdio.h>
#include<conio.h>
int main (){
float a,b,h,area;
printf("Enter the first side of triangle:");
scanf("%f",&a);
printf("Enter the second side o... |
C | #include <stdio.h>
#include <time.h>
#include "cliente.h"
struct Pedido {
char* dataHora;
struct Cliente* cliente;
};
struct Pedido* New_Pedido(){
struct Pedido* pedido;
pedido = malloc(sizeof(struct Pedido));
return pedido;
}
void Del_Pedido(struct Pedido* pedido) {
free(pedido);
}
char* Pe... |
C | #ifndef HELPERS_H
#define HELPERS_H
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <semaphore.h>
#include <sys/socket.h>
#include "wrappers.h"
/*There are under 200 countries in the world*/
#define COUNTRIES 200
/*Linked list to keep tra... |
C | /*Creați o structură denumită Angajat, care să rețină:
-Numele și prenumele fiecărui angajat;
-CNP-ul,
-Numărul de ani vechime,
-Plata pe oră
-Numărul de ore lucrate
-Remunerația (calculată ca plata pe oră * nr-ul orelor
lucrate).
Cu structura creată anterior:
- Introduceți și afișați datele unui angajat;
- Introduce... |
C | #include<stdio.h>
#include<string.h>
int main()
{
int i,repeat,l;
char text[1000],long_letter,small_letter;
fgets(text,sizeof text,stdin);
l=strlen(text);
for(long_letter='A',small_letter='a';long_letter<='Z';long_letter++,small_letter++)
{
repeat=0;
for(i=0;i<l;i++)
{
if(text[i]==long_letter || text[i]=... |
C | #ifndef __MACRO__PROFILAGE__
#define __MACRO__PROFILAGE__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/time.h>
static FILE* log = NULL;
#define PROFILE \
struct timespec start_log, end_log; \
clock_gettime(CLOCK_REALTIME, &start_log); \
if(log == N... |
C | int main(){
int i,n,x,y,w;
int a,b;
a=0;b=0;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d %d",&x,&y);
w=y-x;
if(w==1){
a++;}else
if(w==2){
b++;}else
if(w==-1){
b++;}else
if(w==-2){
a++;}
}
if(a>b){
printf("A");
}else
if(a<b){
printf("B");
}else {
prin... |
C | ////////////////////////////////////////////
// ȣ : [TST] 幮 ̵
////////////////////////////////////////////
#if 0
#include <stdio.h>
int T; //
int L, R; //ִ ΰ
int N; //
int a[20 + 10]; //
int sol = 0x7fffffff;
#define ABS(x) ((x)>0?(x):-(x))
void DFS(int n, int cnt, int l, int r)
{
if (sol <= cnt) re... |
C | #ifndef __QUEUE_H__
#define __QUEUE_H__
#include <stdio.h>
#include <stdlib.h>
#include "bitnode.h"
#define QUEUE_DEBUG 0
typedef btnode_t* qdata_t;
struct _que_node_ {
qdata_t data;
struct _que_node_ *next;
};
typedef struct _que_node_ qnode_t;
struct _linkqueue_ {
qnode_t *head;
qnode_t *tail;
int clen;
int... |
C | /*
* M41T64_Clock.c
*
* Version: 0.0
* Date: 16.1.2015
*
* Develop: Ivan Neskorodev
* Email: ivan.neskorodev@gmail.com
*
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/i2c-dev.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fc... |
C |
#include "omni.h"
#include "chassis.h"
#include "speed_control.h"
#include "USART1.h"
#define SPEED_MAX 150
#define SPEED_K 0.01
u8 OmniData[8];
float AmplitudeCheck(float Angle , float limit)
{
if(Angle>limit) Angle=limit;
if(Angle<-limit) Angle=-limit;
return Angle;
}
/*
* omni
* յңϢҡλתΪĵֵ
* :
... |
C | #include<stdio.h>
#include<math.h>
#define max 101
int main()
{
unsigned long long int arr[max];
int i,N;
arr[1]=1;
arr[0]=0;
for(i=2;i<max;i++)
{
arr[i]=(i*i)+arr[i-1];
}
while(scanf("%d",&N))
{
if(N==0)break;
printf("%d\n",arr[N]);
}
return 0;
}
|
C | /* TM110cylcavity.c - Cylindrical TM110 mode resonant cavity */
/* Jacco Nohlmans, Bas van der Geer
* 29-sep-06
*/
#include <stdio.h>
#include <math.h>
#include "elem.h"
#define x11 3.83170597020751231561
struct tmcav_info
{
double d, radius ;
double fac, phi ;
double w110 ;
} ;
static i... |
C | #include "holberton.h"
#include <stdlib.h>
/**
* *str_concat - main function
* @s1: parameter
* @s2: parmeter
* Return: s
*/
char *str_concat(char *s1, char *s2)
{
char *s;
int i = 0, j = 0, k, l, m = 0;
if (s1 == NULL)
s1 = "";
if (s2 == NULL)
s2 = "";
while (s1[i] != '\0')
i++;
while (s2[j] != '\0')... |
C | /******************************************************************************
*
* File: delaunay.h
*
* Created: 04/08/2000
*
* Author: Pavel Sakov
* CSIRO Marine Research
*
* Purpose: Header for delaunay triangulation wrapper
*
* Description: None
*
* Re... |
C | //------------------------------------------------------//
// NAME: Noah de Longpre' User ID: nkdelong //
// DUE DATE: 10/20/2017 //
// PROGRAM ASSIGNMENT 2 //
// FILE NAME: merge.c //
// PROGRAM PURPOSE : ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | /*
* Jean Choi
* 6/30/2020
* CS410P: Exploring Fractals, taught by Dr. David Ely
*
* The goal of this program is to create an equilateral triangle
* that sits insde another equilateral triangle, using the midpoints
* of the larger triangle as the new points.
*/
#include "FPToolkit.c"
#include <stdio.h>
#include <math... |
C | /* additional.c
when argc is 1, execute fibonacci calculating
when argc is 4, get max of four numbers */
#include <stdio.h>
#include <syscall.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
{
switch(argc){
case 2:
{
int result = fibonacci(atoi(argv[1]));
printf("%d\n", result);
r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.