language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /******************************************************************************
* Based on OriginalNQueensSolver.
*
* Removed field x since there is no real use for it
* Removed maxN and used n instead (use malloc to reserve int arrays on heap)
* Common subexpressions eliminated
* Symmetrie checking along the ver... |
C | /*
* Macro di root per analizzare i dati.
* Lanciare come:
*
* shell> root -l
* root[0] .L Analyze.C
* root[1] Analyze("nomeDelFile.root")
*/
void PlotMedia(const char* fileName, int j)
{
// apre file prende il TTree di nome "datatree" dal file
TFile* file = new TFile(fileName);
TTree* tree = ... |
C | // ȸ α
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <Windows.h>
#include <time.h>
#include <mmsystem.h>
#pragma comment (lib ,"winmm.lib")
#pragma warning (disable:4996)
// ȸ α Define
#define NUM_OF_MEMBERS 200
#define NUM_OF_PRINT 20
#defin... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
void computelps(char* pat, int* lps, int l)
{
int len = 0;
lps[0] = 0;
int i = 1;
while(i < l)
{
if(pat[i] == pat[len])
{
len++;
i++;
lps[i] = len;
}
else
{
if(len != 0)
{
len = lps[len-1];
}
else
{
lps[i] = 0;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fp;
int value;
fp = fopen( "data.txt", "r" ); /* open for reading */
if ( fp == NULL ) /* check does file exist etc */
{
printf( "Cannot open data.txt for reading \n" );
exit(1); /* terminate program THERE IS A BETTER WAY TO DO THIS! */
}
fscan... |
C | /*******************************************************************************
* File Name: debug.c
*
* Version: 1.0
*
* Description:
* This file contains the definiton for debug functions, using UART as communication
* medium. These function sends UART data to KitProg/PSoC 5LP, which enumerats as
* COM port on conne... |
C | #include <stdio.h>
long int factorial(int number);
void main() {
int number;
printf("Enter a positive number: ");
scanf(" %d", &number);
printf("The factorial of %d is %d\n", number, factorial(number));
}
long int factorial(int number) {
if(number >= 1)
return number * factoria... |
C | #include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
int main (int argc, string argv[]) {
if ( argc != 2 ) {
printf("ERROR: No argument detected\n");
return 1;
} else {
char* str = GetString();
int len = strlen(str);
int k = atoi(argv[1]);
... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
int main(int argc,char *argv[])
{
int fd;
if((fd=open(argv[1],O_RDWR|O_CREAT,0644))<0)
{
perror("Error for open");
return 1;
}
printf("fd=%d\... |
C | #include "get_next_line.h"
#include "libft/libft.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
int ft_position_bis(char **save, char **line, int i)
{
int ret;
char *tic;
char *tac;
ret = 0;
while ((*save)[i] != '\n' && (*save)[i])
i++;
if ((*save)[i] == '\n')
ret = 1;
i++... |
C | #include "holberton.h"
#include <stdlib.h>
#include <stdio.h>
/**
* _print_int_binary - Prints a int converted to binary
* @args: A list of variadic arguments
*
* Return: The number of printed digits
*/
int _print_int_binary(va_list args)
{
unsigned int x = 0;
int b = 0, new = 0;
new = va_arg(args, int);... |
C | /*
* @file list27.c
* @brief 読み込んだ整数値を3で割った剰余を表示
* @author mogi
* @date 2018/3/17
*/
#include <stdio.h>
int main(void){
int no;
printf("%d",&no);
switch(no % 3){
case 0 :puts("その数は3で割り切れます"); break;
case 1 :puts("その数を3で割った剰余は1です。"); break;
case 2 :puts("その数を3で割った剰余は2です。"); break;
}
return 0;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include "pilha.h"
struct pilha {
int v[MAX];
int topo;
};
Pilha * cria_pilha () {
Pilha * p = (Pilha *) malloc (sizeof(Pilha));
if (p)
p->topo = 0;
return p;
}
int pilha_vazia (const Pilha *p) {
/*if (p->topo == 0)
return 1;
else
return 0;*/
return !p->topo;
}
in... |
C | //
//
//
#include "driver/gpio.h"
static gpio_num_t dht11_pin;
static void dht11_delay_ms(uint16_t i) {
while (i--) {
os_delay_us(1000);
}
}
static void dht11_SetPinOutput(void) {
gpio_config_t config;
config.pin_bit_mask = (1 << dht11_pin);
config.mode = GPIO_MODE_OUTPUT_OD;
gpio_config(&... |
C | #include<stdio.h>
int main() {
int a[100], n, i, j, temp;
printf("Enter how many numbers you want:\n");
scanf("%d", &n);
printf("Enter the %d elements:\n", n);
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
printf("\n\tThe given array is:\n");
for (i = 0; i < n; i++) {
printf("\n\t\t%d", a... |
C | #pragma once
#ifndef __BINARY_TREE
#define __BINARY_TREE
#define TRUE 1
#define FALSE 0
typedef int BTData;
typedef struct _node {
BTData data;
struct _node *left;
struct _node *right;
} Node;
typedef Node BTreeNode;
BTreeNode * MakeBTreeNode(void);
BTData GetData(BTreeNode * bt);
void SetData(BTreeNode * bt,... |
C | // namespace.h
#ifndef NAMESPACE_H
#define NAMESPACE_H
#include <stdio.h> // for printf()
#include <stdlib.h> // for EXIT_SUCCESS
#define UNIQUE_PREFIX_DEFAULT_NAMESPACE vector
#ifdef UNIQUE_PREFIX_NAMESPACE
#define UNIQUE_PREFIX_DOT_NAMESPACE UNIQUE_PREFIX_NAMESPACE
#endif
#ifndef UNIQUE_PREFIX_NAMESPACE
#defi... |
C |
#include <ti/devices/msp432p4xx/driverlib/driverlib.h>
// This function initializes all the peripherals
void initialize();
int main(void)
{
initialize();
while (1) {
// If the button is not pressed, turn the LED off
// We use PxIN and PxOUT for this
}
}
void initialize()
{
... |
C | #include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <linux/uaccess.h>
#include "modIO_define.h"
static int device_open(struct inode *, struct file*);
static int device_release(struct inode *, struct file *);
static ssize_t device_read(struct file *, char *, size_t... |
C | /* Problem 123 = 21035 */
#include <stdio.h>
#include "../algorithms.h"
#include "../list_math.h"
/* http://en.wikipedia.org/wiki/Modular_exponentiation */
long long list_modulus_power(long long base, long long exponent, long long modulus) {
long long result = 1;
struct list *multiplicand_list;
... |
C | /*
* dict.h
*
* Created on: Apr 11, 2015
* Author: user
*/
#ifndef DICT_H_
#define DICT_H_
#endif /* DICT_H_ */
enum WordType{All, Animal, Fruit, Name};
struct Word{
WordType type;
char word[20];
};
struct Dict{
int size;
int capacity;
Word** wordArray;// a POINTER to a POINTER th... |
C | // SPDX-License-Identifier: CC0-1.0
//
// SPDX-FileContributor: NightFox & Co., 2009-2011
//
// Water reflection effect (with scroll).
// http://www.nightfoxandco.com
#include <stdio.h>
#include <nds.h>
#include <filesystem.h>
#include <nf_lib.h>
// Wave effect variables
u16 mapa[32][24]; // Map
s16 bgx[192]; ... |
C | /*
* =====================================================================================
*
* Filename: strArray.c
*
* Description: when we assign string literals to char *, the strings themselves are allocated in read-only memory. However, the array string_array is allocated in read/write memory. This ... |
C | /* Assignment operators */
#include <stdio.h>
int main(){
/*
Guess the output of all calculations
*/
int x=2;
int y; int z;
x*=3+2;
printf("x=%d\n", x);
printf("Guess 10\n");
x*=y=z=4;
printf("x=%d\n", x);
printf("Guess 40\n");
x=y==z;
printf("x=%d\n", x);
printf("Guess 1\n");
return 0;
} |
C | /*
* log.c
*
* Created on: Jan 2, 2016
* Author: mori
*/
#include "log.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#define LOGGER_MAXLEN 250
#define LOGGER_TIMEOUT 10
void write_string(const char *data)
{
uint8_t temp[200] = {0};
strcpy(&temp, data);
temp[strlen(data)] = '\r';
tem... |
C | #include <stdio.h>
#include <stdlib.h>
#include "rfcn-fr.h"
int main()
{
FILE *fd;
char buf[200];
char r;
float ca_freq;
int i;
int band = 0;
float rfcn = -1;
int mode = 0;
float Band_Ca_Freq_Max;
float Band_Ca_Freq_Min;
float in_rfcn;
float out_ca_fr;
char cc;
do
{
printf("1: RFCN--->Carrier Frequ... |
C | #include <stdio.h>
#include <stdlib.h>
struct node{
int data;
struct node *left;
struct node *right;
};
struct node *new_node(int data){
struct node *temp = (struct node*)malloc(sizeof(struct node));
temp->data = data;
temp->left=temp->right = NULL;
return temp;
}
void inOrder(struct node *root){
if(root!=NU... |
C | /*
char string
*/
#include <stdio.h>
#include <string.h>
int main()
{
char date[] = "Febur 8";
char *p;
p = date;
int a[5] = {3,4,7,8,1};
int *d;
d = a;
printf("date1: %s\n", date);
printf("date2: %s\n", p);
printf("a: %d\n", *d);
puts(date);
return 0;
}
|
C | /*
** my_put_nbr.c for my_put_nbr in /home/ayasch_d/rendu/Piscine_C_J03
**
** Made by Dan Ayasch
** Login <ayasch_d@epitech.net>
**
** Started on Thu Oct 2 10:49:30 2014 Dan Ayasch
** Last update Wed Apr 29 13:32:45 2015 Dan Ayasch
*/
#include "list.h"
int my_putnbr(int nb)
{
int nombre;
if (nb >= 0)
{... |
C | #include <stdio.h>
#define N5;
int front=-1,rear=-1;
int deque[N];
void enqueuefront(int x){
if()(f==0&&R==N-1)||(front==rear+1))
{
printf("queue is full");
}
else if(front==-1&&rear==-1){
front=rear=0;
deque[Front]=x;
}
else if(front==0){
front=N-1;
deque[front]=x
}
else{
front--;
deque[front]=x;
}
}
void... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{ int s=0,l;
int a[100];
for(;;)
{
scanf("%d",&a[s]);
if(a[s]==" ")
break;
printf("%d",a[s]);
s++;
}
return 0;
}
|
C | #include "holberton.h"
/**
* print_numbers - prints number followd by a new line
*/
void print_numbers(void)
{
char num;
for (num = 48; num <= 57; num++)
{
_putchar (num);
}
_putchar ('\n');
}
|
C | /*
** kind_texture_perlin.c for kind_texture_perlin.c in /home/sabour_m//RTV/rt
**
** Made by mourad sabour
** Login <sabour_m@epitech.net>
**
** Started on Sun Jun 5 11:59:46 2011 mourad sabour
** Last update Sun Jun 5 12:08:18 2011 mourad sabour
*/
#include "rt.h"
#include "struct.h"
int get_marbre_color... |
C | //Disjoint Sets
#include<stdio.h>
char Bs2[9]="";
char Bs1[9]="";
char UN[9]="",IN[9]="",DI[9]="";
void bitStringCreation(int U[],int S1[],int S2[],int k)
{
int ii=0,j=0,i=0;
for(i=0;i<k;i++)
{
if(U[i]==S1[ii])
{
ii++;
Bs1[i]='1';
}
else
{
Bs1[i]='0';
}
... |
C | /* 153.
Scrivere una funzione che, a partire da due liste, ne costruisca una terza ottenuta alternando gli
elementi delle altre due.
*/
#include <stdio.h>
#include <stdlib.h>
/* struct fusione di list1 e list2 */
struct list3
{
int num;
struct list3 *bridge;
};
/* struct di interi da fondere con lis... |
C | /*
* Filename: timer.c
* Description: this module provides 32bit timer using 16 bit hardware
* implementation Timer1. Module Also initializes additional timers (Timer0 and
* Timer2) and provides defines (T0_FREQ and T2_FREQ) for its frequencies.
*
* Created on: Aug 21, 2012
* Author: dart
*/
#include... |
C | /*******************************************************************
ļ: 8λʾ(רڿ)
:
汾:
˵:
ޱؼ¼:
: 2008 7 21
********************************************************************/
#ifndef __disp_h__
#define __disp_h__
#include "xuxiuliang.h"
#define Port P0
/********************... |
C | #include <stdio.h>
#include <conio.h>
#include <math.h>
#include <stdlib.h>
#include <locale.h>
#include <time.h>
int main() {
setlocale(LC_ALL, "ua");
exOne();
printf("\n\n");
system("pause");
return 0;
}
int exOne() {
int a,b,c,cOne = 0,aOne = 0,bOne = 0;
printf("Введiть число A = ");
scanf("%d",&a);
... |
C | #include</test/linkedlist/ll.h>
int add_node(node_t ** head, int num){
node_t * temp = * head;
node_t * node = (node_t *) malloc(sizeof(node_t));
node->data = num;
node->next = NULL;
if (*head == NULL){
*head = node;
//printf("print %d\n", (*head)->data);
return 1;
}
while (temp->next != NULL ){
... |
C | /************************************************************************************************************************
* Simple application that tries to execute machine code from many different memory locations.
*
* Francisco Soto <ebobby@ebobby.org>
*************************************************************... |
C | #include<string.h>
void* memchr(const void*, int, size_t);
int memcmp(const void*,const void*, size_t);
void* memcpy(void*, const void*, size_t);
void* memmove(void*, const void*, size_t);
void* memset(void*, int, size_t);
//-------------------------------------------------------------------------
char* strncat(char*,... |
C | /* Copyright (c) 2002, Steve Dekorte
* All rights reserved. See _BSDLicense.txt.
*/
#include "IoNumber.h"
#include "IoObject.h"
#include "IoState.h"
#include "IoNil.h"
#include "IoString.h"
#include "IoBuffer.h"
#ifndef IO_OS_L4
#include "IoDate.h"
#endif
#include "IoState.h"
#include <math.h>
#include <ctype.h>... |
C | /*
* AGV.c
*
* Created: 05/11/2013 17:01:06
* Author: mayur
*/
#define F_CPU 8000000
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "mydefs.h"
void left_motor(signed int i)
{
if (i == 1)
{
set(PORTB,4);
clr(PORTB,2);
}
else if (i == -1)
{
set(PORTB,2);
clr(PORTB,4);
}
else ... |
C | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#define MAX 0
#define ARRAY_SIZE 8
void swap( int x, int y, int array[] ){
int aux;
// aux assume o valor de x
aux = array[x];
// valor de y é guardado na posicao x
array[x] = array[y];
// valor anterior de x é guarda... |
C | /*********************************************************************/
/* */
/* File Name: CALLREXX.C */
/* */
/* Description: Provides... |
C | // 5subjectmarks.cpp : This file contains the 'main' function. Program execution begins and ends there.
//wap to accept 5 subject marks using while loop calculate total, per, and grade.
#include <stdio.h>
int main()
{
int sub, total=0;
int cnt = 1;
float per;
while (cnt <= 5) {
printf("Enter %d subject marks\n"... |
C | /*---------------------------------------------------------------------------------------------
Author :
Created Date : 2015-02-03
Descriptions : ܺ
Version Description Date Author
0.1 Created 2015-02-03 ... |
C | #include <string.h>
#include <stdio.h>
/* reference implementation
*
* char *
* __strncpy_chk (char *s1, const char *s2, size_t n, size_t s1len)
* {
* if (__builtin_expect (s1len < n, 0))
* __chk_fail ();
*
* return strncpy (s1, s2, n);
* }
*
* __fortify_function char *
* __NTH (strncpy (char *__re... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <conio.h>
#define IMAGEM1 "somaP_1.bmp"
#define IMAGEM2 "somaP_2.bmp"
#define IMAGEM3 "ROTAO.bmp"
#pragma pack(push, 1)
struct{
char assinatura[2];
int sizefile;
short int reserved1;
short int reserved2;
in... |
C | #include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <ajit_access_routines.h>
#include <core_portme.h>
#include <macros.h>
#include <frame_finder.h>
void initFrameFinder(FrameFinder* bds, uint8_t sat_id)
{
bds->sat_id = sat_id;
bds->collected_byte = 0;
bds->internal_counter = 0;
bds->fsm_state = LOO... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
//my_strncpy
void my_strncpy(char*p1, const char*p2, int sz)
{
while (sz && (*p1++ = *p2++))
{
sz--;
}
while (sz&&*p1)
{
*p1++ = '\0';
}
return p1;
}
int main()
{
char arr1[10] = { "abcdefg" };
char arr2[] = { "shuai" };
my_strncpy(a... |
C | /************************
Comentários Gerais:
- Implementar lista de prioridades (furar fila na função que recebe as entradas)
************************/
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include "lista.h"
/*************
FUNÇÕES
**************/
void IniciaAduana(int **patio)
{
int i;
for ... |
C | /*ԼС*/
#include <stdio.h>
int hcf(int a,int b)
{
int r=0;
while(b!=0)
{
r=a%b;
a=b;
b=r;
}
return(a);
}
lcd(int u,int v,int h)
{
return(u*v/h);
}
main()
{
int u,v,h,l;
scanf("%d%d",&u,&v);
h=hcf(u,v);
printf("H.C.F=%d\n",h);
l=lcd(u,v,h... |
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
char a = getchar();
printf("%c\n",
((a >= 'A' && a <= 'Z') || (a >= 'a' && a <= 'z'))
? ((a >= 'A' && a <= 'Z') ? (a - 'A' + 'a') : (a - 'a' + 'A'))
: a);
return 0;
}
|
C | #include <reg51.h>
#include <intrins.h>
#define LED_PORT P0 //ʾ
sbit LSP138A = P2^2; //λѡ
sbit LSP138B = P2^3;
sbit LSP138C = P2^4;
unsigned int ledNumVal, ledOut[8];
unsigned char code dispTab[] = {
~0xC0,~0xF9,~0xA4,~0xB0,~0x99,~0x92,~0x82,~0xF8,~0x80,~0x90,
~0x88,~0x83,~0xC6,~0xA1,~0x86,~0xbf,~0xc7,~0x8c,~0xc1,... |
C | #include<stdio.h>
int main(){
float avg;
int tot=23;
int count=4;
avg=(float)tot/count;
printf("%f",avg);
}
|
C | // Based on example program from
// http://stackoverflow.com/q/1821806/101258
#include "write-png.h"
/* Attempts to save PNG to file; returns 0 on success, non-zero on error. */
int bitmap_save_to_png(RGBBitmap *bitmap, const char *path)
{
FILE *fp = fopen(path, "wb");
png_structp png_ptr = NULL;
png_infop... |
C | #include <stdio.h>
#include <stdlib.h>
#include "funciones.h"
int main()
{
int num, fact1, fact2, resulFac;
float numero1=0;
float numero2=0;
float resultado;
int continuar=1;
while(continuar==1)
{
system("cls");
printf("\n - Calculadora - \n\n");... |
C | //
// clientCommands.c
// CloudClient
//
// Created by Lion User on 14/10/2012.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const char list[][30] = {
"-exit", //0
"-registerNewAccount", //1
"-login", //2
"-help" //3
}... |
C | #include "/players/beck/rangers/Defs.h"
id(str){
return str == "pool" || str == "golds_gym_pool";
}
short(){ return "Golds Gym Pool"; }
is_pool(){return 1;}
long(){
write("This is the pool at the Golds Gym facilities.\n"+
"You can do your swimming and water running workouts here,\n"+
"or you can just loung... |
C | int main()
{
int row,col;
cin>>row>>col;
int a[100][100];
int (*aa)[100]=a;
for(int i=0;i<row;i++)
{
for(int j=0;j<col;j++)
{
cin>>a[i][j];
}
}
for(int i=0;i<col;i++)
{
int r=0;
int c=i;
while(r<=row-1&&c>=0)
{
cout<<*((*(aa+r))+c)<<endl;
r=r+1;
c=c-1;
}
}
... |
C | /*
* AVR_HC-SR04_sensor.c
*
* Created: 31.12.2020 13:38:11
* Author : oxford
*/
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <math.h>
#include "AVR_HC-SR04_sensor.h"
#include "mkuart.h"
/******************************** VARIABLES **************************************... |
C | #include "compression_biblio.h"
void decompressBmp(char *src, char *dst)
{
FILE *ficSource;
FILE *ficDestination;
typeEnTeteFichierBmp enTeteFic;
typeEnTeteImageBmp enTeteImg;
typeCouleur palette[NBCOULEURS];
int retour;
unsigned int tailleFicDest;
unsigned int tailleImgDest;
unsig... |
C | //#include<stdio.h>
//#include<stdlib.h>
//#include<string.h>
//int main()
//{
// char s[100];
// char *p, *q, *o;//p指向数字,q指向字母
// while (printf("输入字符串:"),rewind(stdin),gets(s) != NULL)
// {
// p = s; q = s + 1;
// char temp;
// while (*q != '\0'/*&& *p != '\0'*/)
// {
// while (*p >= '0'&&*p <= '9')
// {
// ... |
C | /*
* 文件名: mcat.c
* 描述: dup2 函数实现重定向
* bin/mcat + file (+ 为输入重定向))
* bin/mcat - file (- 为输出重定向)
* 完成日期: 2018年2月1日16:37
*/
#include "io.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
int main(int argc, char* argv[])
{
int fd_in ,fd_out;
int flag = 0;
int... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
char v1,v2,buffer;
printf("Introduza 2 Caracteres\n");
scanf("%c %c",&v1, &v2);
printf("Valor introduzido : \n\n\t v1:%c | | v2:%c\n\n\n",v1,v2);
buffer = v1;
v1=v2;
v2=buffer;
printf("Valor trocado : \n\n\t v1:%c | | v2:%c\n\n",v1,v2)... |
C | #include<stdio.h>
int main(){
int n;
int arr[100][100];
scanf("%d",&n);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
scanf("%d",&arr[i][j]);
}
}
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(arr[i][j]!=arr[j][i]){
printf("Not Symm... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define VERTEX_WAS_CHECKED -1
#define MAX_VERTEX_NUM 1000
typedef enum checkData {
badVertex,
success,
noInput,
impossibleToSort,
badNumOfLines,
badNumOfVertices,
badNumOfEdges
} resultOfWorking;
typedef struct edge {
int begi... |
C | #include <stdio.h> //printf
#include <string.h> //memset
#include <stdlib.h> //exit(0);
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/socket.h>
#include <fcntl.h> // for open
#include <unistd.h> // for close
#include <time.h>
// -------------------------------------- //
// --- ATTENTION! USE THIS TO LISTEN!... |
C | #ifndef CHARACTER_LIST
#define CHARACTER_LIST
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "character.h"
#include "equipment_array.h"
typedef struct linked_list {
character_t head;
struct linked_list *tail;
} linked_list_t;
typedef struct {
// Pointer to the __first... |
C | #include <stdio.h>
/* Създайте нов потребителски тип
към тип long long int. Използвайте го във функцията
printf, отпечатайте размера. */
int main(void){
typedef long long int t_lNum;
t_lNum num = 4000000000000;
printf("%lld\n", num);
t_lNum num1 = 3000000000000;
t_lNum *t_point;
t_point = ... |
C | #include <stdio.h>
#include <stdlib.h>
int compresslength(char* input)
{
char letter = input[0];
int inputsize = 0;
int i = 0;
int lettercount = 1;
int length = 0;
while(letter != '\0') {
if( (letter >= 48 && letter <= 57) ) return -1;
if( (letter != input[i]) ) {
//Every part of the output string is g... |
C | #include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
struct node // Step 1 //
{
int data;
struct node *next;
}node2,node3,node4; // Step 2 and 3 and 4 //
struct node *start = NULL;
struct node *insert_beg(struct node *, int number);
struct node *del_all(struct node *);
struct node *display_nodes(struct... |
C | #include<stdio.h>
#include<math.h>
main()
{
int k;
k=mul(7);
printf("%d",k);
}
int mul(int a)
{
int s;
if(a==1)
return (a);
s=a*mul(a-1);
return (s);
}
|
C | /*
* bagtest.c - test program for bag module
*
* usage: bagtest
* (no arguments)
* ouput:
* program prints the results of various tests of the
* bag module to stdout, while also informing the user
* of what the desired output is
* functions:
* > delete_func1: a sample delete function pass... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memccpy.c :+: :+: :+: ... |
C | #include "inc/hw_types.h"
#include "utils/ustdlib.h"
#include "lfMotors.h"
#include "lfSensors.h"
#include "lfUtility.h"
#include "lfFollowBehavior.h"
#define MIN_COURSE_CORRECTION 2 // degrees
#define TURN_THRESHOLD 30 // cm
#define DRIVE_THRESHOLD 3 // inches
#def... |
C | #include <clib/base_hdr.h>
#include <clib/stringlist.h>
#include <clib/string.h>
stringlist *stringlistCreate(stringlist *head, string *data, unsigned long index);
int stringlistEnd ( stringlist *current )
{
return ( current == NULL );
}
stringlist *stringlistNext ( stringlist *current )
{
if( current == NULL )
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <string.h>
#include "Communication.h"
/*CSCI311 project3 Zhao Xie
*This program is an interface, which will
*accept commands from the console and send
*them to the Server for execution... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
void citire(int v[], int n)
{
int i;
for (i = 0;i < n;i++) {
printf("v[%d] = ", i);
scanf("%d", &v[i]);
}
}
void egal(int v1[], int v2[], int n)
{
int i;
int egale = 1;
for (i = 0;i < n;i++) {
if (v1[i] != v2[i]) {
egale = 0;
}... |
C | #include "file.h"
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
// Implantation par tableau en file tournante
/*Conventions :
– Tête[F] pointe sur le premier élément à défiler
– Queue[F] pointe sur le premier emplacement libre
– Initialement Tête[F]=Queue[F]=0
– Longueur[F] retourne la taille maximale de... |
C | /* File : usage.c */
#include <stdio.h>
int main () {
int a = 13, b = -9, i, *p = &a; // p is a pointer to int
for (i=0; i<10; i++) {
if ( *p > 0 ) {
p = &b ;
} else if ( *p < 0 ) {
p = &a ;
}
*p = *p + 1 ;
}
printf ( "The value of a and b are : %d and %d \n", a, b);
}
|
C | #include "utils.h"
#include "privilege_escalation.h"
int privilege_escalation(void) {
struct cred *new_cred;
if ((new_cred = prepare_creds ()) == NULL)
{
debug("Cannot prepare credentials");
return 0;
}
V(new_cred->uid) = V(new_cred->gid) = 0;
V(new_cred->euid) = V(new_cred->egid) =... |
C | #include <stdio.h>
#include <time.h>
// experiment: two reverse functions reva(s) & revb(s)
// reva: simply assigns last string character to first and works towards middle
// revb: applies bubble sort with shift for iterations equal to length of s
// hypothesis: reva should be much faster than revb
// yh...
// reva: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_format_unsigneddecimal.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <malloc.h>
#include "ErrorCode.h"
#include "CException.h"
#include "Stack.h"
Stack *stackNew(int lengthOfStack)
{
Stack *stack = malloc(sizeof(Stack));
stack->buffer = malloc(sizeof(int) * lengthOfStack);
stack->size = 0;
stack->length = lengthOfStack;
return stack;
}
int stackisFul... |
C | //jbg@C@2@eLXgSSy[W@Tv2|3A͂AsȂB
//1423056@n糁@ā@2014/10/03
#include <stdio.h>
int main(){
printf("1+1=%d\n", 2);
printf("5-3=%d\n", 5-3);
printf("3*2=%d\n", 3*2);
printf("5/2=%d\n", 5/2);
printf("5%%2=%d\n", 5%2); //ƏŔA3͂ʼn
printf("1.5+1.4=%d\n", 1.5+1.4); //̌vZʂādijŏo
printf("1.5+1.4=%f\n", 1.5... |
C | #include<stdio.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#define MAX_ELEMENTS_IN_ARRAY 100
#define error(...) (frpintf(stderr, __VA_ARGS__))
int read_array(int *array, size_t *array_size)
{
char div = ' ';
size_t element_count = 0;
while (div == ' ') {
if(scanf("%d%c", &array[... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "WolframLibrary.h"
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define sqrt2 1.4142135623730951
//#define MAXDIM 500
DLLEXPORT mint WolframLibrary_getVersion( ) {
return WolframLibraryVersi... |
C |
#include <cblas.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
double *errors;
double a[] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
double b[] = {2.0, 2.0, 2.0, 2.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0};
int i;
errors = (double*)malloc(sizeof(double) * 10);
cblas_dgemv(10, a, b, errors);
i... |
C | /* Author: agonz250
* Partner(s) Name:
* Lab Section: 028
* Assignment: Lab # 8 Exercise #1
* 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>
#ifdef _SIMULAT... |
C |
/**
* 连续输入字符串,请按长度为8拆分每个字符串后输出到新的字符串数组;
长度不是8整数倍的字符串请在后面补数字0,空字符串不处理。
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void output8C(char a[], int len)
{
int i = 0;
while (i < len)
{
printf("%c", a[i++]);
if ((i % 8) == 0)
printf("\n");
}
int left = ... |
C | /////////////////////////////////////////////////////////////////////////////
//
// Matthew Colliss
//
// 2d convolution with image and kernel
//
/////////////////////////////////////////////////////////////////////////////
#include "convolution.h"
void convolve(int target[],int kernal[],int kernalSize,int height,int... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <errno.h>
#include <netdb.h>
#include <arpa/inet.h>
int main(int argc, char const *argv[])
{
int sockfd;
struct addrinfo hints, *results, *p;
struct sockaddr_in *ip_access;
int rv;
char hostname[200];
char ip[256];
char ... |
C | #include <stdio.h>
#include <math.h>
int main(){
long long value, hf, root, i , j;
int is_prime;
printf("Enter a number : ");
scanf("%lld", &value);
hf = (value / 2);
printf("Prime factors : ");
for(i = 2; i <= hf ; i = i+2){
if(i==4) --i;
//if i is dvisible
if(value % i == 0){
hf = value / i;
is_prime = 1;
... |
C | set add_int(set s) {
return add(2 in add(1 in s));
// {1,2}
}
set add_float(set s) {
return add(5.4 in add(1.5 in s));
}
set add_set(set s) {
set newset;
newset = EMPTY;
return add(add_int(newset) in s);
//{{1,2}}
}
int main() {
set s;
s = EMPTY;
add_set(s);
// s = {{1,2... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hardware.h"
#include "bloc.h"
#include "common.h"
#include "volume.h"
#include "mbr.h"
#include "drive.h"
void execute(const char *name){
struct _cmd *c = commands;
while (c->name && strcmp (name, c->name))
c++;
(*c->fun)();
}
void ... |
C | #include <stdio.h>
#include <stdlib.h>
#define N 100
typedef struct {
int length;
int digits[N];
} BigDecimal;
void intToBigDecimal(int i, BigDecimal *d) {
d->length=0;
do {
d->digits[d->length]=i%10;
d->length++;
i/=10;
} while(i);
}
void shiftLeftBigDecimal(BigDecimal *d) {
int i;
for(i=d->length; i>... |
C | #include <stdlib.h>
#include <stdio.h>
#define TAM_VETOR 60
#define MAX_ALEATORIO 356
int main () {
int a[TAM_VETOR], b[TAM_VETOR], c[TAM_VETOR*2],freq[TAM_VETOR], i, j, k, tam_uniao=0, cont;
//Zerando todas as posies de tam_uniao
for (i=0; i<TAM_VETOR; i++ ){
freq[i]=0;
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.