language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
int main(){
int a = 10;
int b = 2;
printf("%d += %d = ", a, b);
a += b;
//a = a + b
printf("%d\n", a);
a = 10;
b = 2;
printf("%d -= %d = ", a, b);
a -= b;
printf("%d\n", a);
a = 10;
b = 2;
printf("%d /= %d = ", a, b);
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ants.c :+: :+: :+: ... |
C | /**
page 410
program 12.6
Write a program to append additional items to the file INVENTORY created in program 12.3
and print the total content of the file.
*/
///program begin
#include<stdio.h>
#include<conio.h>
//main() function begin
struct invent_record
{
char name[10];
int number;
fl... |
C | /* Задача 11. Направете обединение с елементи тип int, int, char. Дайте стойност на елементите
един по един -7, 10 и 'c' и изведете тези стойности на конзолата. */
/* Не разбрах идеята */
#include <stdio.h>
union wabadabadubdub {
int waba;
int daba;
char dub;
};
int main() {
union wabadabadub... |
C |
#include <stdlib.h>
#include <stdio.h>
#include "osc_types.h"
extern osc_node *osc_root;
static osc_node *init_working_set(osc_node *root)
{
osc_node *working_set = NULL;
while (root != NULL) {
root->next = working_set;
working_set = root;
root = root->sibling;
}
return working_set;
}
s... |
C | /* Thomas BERNARD */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hfscommon.h"
enum command {
INVALID = 0,
SHOW = 1,
DISABLE,
SETROOT,
SETID
};
void writeu32(unsigned char * p, uint32_t i)
{
p[0] = (i >> 24) & 0xff;
p[1] = (i >> 16) & 0xff;
p[2] = (i >> 8) & 0xff;
p[3] = i & 0xff;
}
... |
C | /**
* This file contains all of the data used to configure the robot
*
* @author Thomas Batchelder
* @date 1/19/2021 - Created configuration file
*/
#pragma once
#include <Arduino.h>
#define BAUDRATE 250000 // Serial monitor baud rate
#define STARTUP_DELAY 7500 // Delay at beginning of program to let Serial ... |
C | #include <stdio.h>
typedef struct pnode
{
float coef;
int exp;
struct pnode *next;
}p;
p *getnode();
void main()
{
p *p1,*p2,*p3;
p *getpoly(),*add(p*,p*);
void display(p*);
printf(“enter first polynomial”);
p1=getpoly();
printf(“\n enter second polynomial”);
p2=getpoly();
printf(“\nthe first polynomial is”);
display... |
C | #include<stdio.h>
/**
* main - if q or e , dont print if a - z putchar
*
* Return: 0
*/
int main(void)
{
char ch = 97;
while (ch >= 97 && ch <= 122)
{
if (ch != 101 && ch != 113)
putchar(ch);
ch++;
}
putchar('\n');
return (0);
}
|
C | //
// Function.h
// Lab2
//
// Created by Sorokin Dmytro on 4/7/16.
// Copyright (C) 2016 Sorokin Dmytro. All rights reserved.
//
#ifndef FUNCTION_H_INCLUDED
#define FUNCTION_H_INCLUDED
typedef struct __IntNode IntNode;
struct __IntNode
{
int value;
IntNode *nextNode;
};
IntNode *CreateN(... |
C | #include"myheader25.h"
struct node *root=NULL;
void Search(int item, struct node **par, struct node **loc)
{
struct node *ptr,*ptrsave;//save parent of ptr
*loc=NULL;
if(NULL==root) /*tree empty*/
{
*loc=NULL;
*par=NULL;
return ;
}
if(item==(root)->info) /*item is at root*/
{
*loc=root;
*par=NULL;
r... |
C | #include<stdio.h>
#include<string.h>
int main()
{
char name[3] = {'R','J', '\0'};
char str1[65], str2[98], str3[32];
strcpy(str1, "Kedar");
strcpy(str2, "Raj");
printf("%s\n",name);
printf("%s\n",str1);
printf("%s\n",str2);
strcat(str1, str2);
printf("%s\n... |
C | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
int find(int n)
{
int sum = 0;
int i = 0;
int j = 0;
int k = 0;
int arr[200];
for (i = 0; i < 999; i++)
{
for (j = 2; j < i; j++)
{
if (i%j == 0)
{
break;
}
if (j == i - 1)
{
printf("%d ", i);
arr[k] = i;
k++... |
C | #include <pty.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <errno.h>
#include <math.h>
#include <signal.h>
#include <string.h>
static void color(int depth, FILE *out1, FILE *out2) {
static char *colors[] = {
"\x1b[31m",
"\x1b[32m",
"\x1b[33m",
"\x1b[34;1m",
"\... |
C |
#include <stdio.h>
#include <stdlib.h>
/*
*
*/
//el el cuadrado, cubo, elevado a la cuarta y quinta.
int main(int argc, char** argv) {
int a;
scanf("%d",&a);
int b=2;
while(b <= 5){
a = a * a;
printf("%d \n",a);
b=b+1;
}
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "cJSON.h"
#include "seniverse_weather.h"
#include "seniverse_cJson_utils.h"
#include "test_weather_location.h"
/*
API: https://api.seniverse.com/v3/weather/now.json?key=your_api_key&location=beijing&language=zh-Hans&unit=c
参数名 ... |
C | char *ft_strcat(char *dest, char *src);
#include <stdio.h>
#include <string.h>
int main()
{
char dest[20]= "coucou";
char src[50]= "les loulous";
printf("%s", ft_strcat(dest, src));
printf("\n");
char dest1[20]= "coucou";
char src1[50]= "les loulous";
printf("%s", strcat(dest1, src1));
return (0);
}
|
C | // Author: Johnnie Alan
#include "testStruct.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <time.h>
int testFunc1(void);
int testFunc2(void);
int testFunc3(void);
bool flag = false;
void child_handler(int sig, siginfo_t *siginfo, void *context)
{
if(si... |
C | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <signal.h>
#include "global.h"
int crianovapos(struct artigo art){
char buffer[1024];
char BUFFER[1024];
int codigo;
int fd1=open("strings.txt... |
C | #include "mem.h"
void memory_copy(uint8_t *source, uint8_t *dest, int nbytes) {
// this is good old memcpy
int i;
for (i = 0; i < nbytes; i++) {
*(dest + i) = *(source + i);
}
}
|
C | #include <stdio.h>
int fahr=0;
float celcius;
#define INFERIOR 0
#define SUPERIOR 300
#define PASSO 20
int main()
{
while (fahr <= SUPERIOR)
{
celcius= (5.0 / 9.0) * (fahr - 32 );
printf("%3d\t%6.2f\n",fahr,celcius);
fahr=fahr + PASSO;
}
return 0;
} |
C | /*
** EPITECH PROJECT, 2020
** my_printf
** File description:
** recreation of _printf_function
*/
#include <stdarg.h>
#include <unistd.h>
#include "my.h"
void switch_casep1(char flag, va_list args)
{
switch (flag) {
case 'd':
my_put_nbr(va_arg(args, int));
break;
case 's':
my_puts... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <semaphore.h>
#define NUM_PROC 5
#define NUM_ELEM 200
int main(){
FILE *fp;
pid_t p[NUM_PROC];
int i, j, c, estado;
se... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
static int ask();
extern void exit();
extern char *malloc();
extern void perror();
char first_on_queue[] = "-> first message on queue",
full_buf[] = "Message buffer overflow. Extra message text\
discarded.";
main()
{
register... |
C | /*
* tests.c
*
* Created on: 20 oct. 2019
* Author: Manu Cabello
*/
#include "ejercicios/ejercicio1.h"
#include "ejercicios/ejercicio2.h"
#include "ejercicios/ejercicio3.h"
#include "ejercicios/ejercicio4.h"
#include "ejercicios/ejercicio5.h"
int main(void) {
// ejercicio1((char*) "ficheros/P... |
C | /*
* Démonstration 1:
* Nous allons créer un programme qui crée deux processus fils.
*/
#include <sys/wait.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
printf("Hello from root process\n");
pid_t child1PID = fork();
if (child1PID... |
C | #include <stdio.h>
int main(void)
{
int x, first, second, third, fourth, fifth;
printf("Enter value of x: ");
scanf("%d", &x);
first = 3 * x * x * x * x * x;
second = 2 * x * x * x * x;
third = 5 * x * x * x;
fourth = x * x;
fifth = 7 * x;
printf("Polynomial resut: %d\n", first + ... |
C | /**
* comnpilar con: gcc p2.c -lproj
*/
#include <stdio.h>
#include <proj.h>
int main (void) {
PJ_CONTEXT *C;
PJ *P;
PJ* P_for_GIS;
PJ_COORD a, b;
/* or you may set C=PJ_DEFAULT_CTX if you are sure you will */
/* use PJ objects from only one thread */
C = pro... |
C | #include <stdio.h>
#include <stdlib.h>
#include "hash_table.h"
#define HASH_OFFSET 0
#define HASH_A 1
#define HASH_B 2
///HASH table node
typedef struct hashtable {
unsigned int hash_val_a;
unsigned int hash_val_b;
int exists;
int key_len;
void *value;
} hashtable_t;
///HASH table
static hashtab... |
C | #include<stdio.h>
#include <math.h>
main(){
double A,raio, pi;
pi = 3.14159;
//printf("digite o raio\n");
scanf("%lf", &raio);
A= pow(raio,2)*pi;
printf("A=%2.lf\n", A);
}
|
C | #include "rtv1.h"
void ft_pvect(char *str, t_vect v)
{
printf("%s %f %f %f\n", str, v.x, v.y, v.z);
}
t_vect ft_rot_x(t_vect v, double a)
{
t_vect v1;
v1.x = v.x;
v1.y = cos(a) * v.y - sin(a) * v.z;
v1.z = sin(a) * v.y + cos(a) * v.z;
return v1;
}
t_vect ft_rot_y(t_vect v, double a)
{
t_vect v1;
v1.x = v.x * ... |
C | //========================================================================
// merge-sort.c
//========================================================================
// Implementation of the merge sort function
//
//--------------------!!! IMPORTANT NOTE !!!------------------------------
//
// You need to use ece2400_m... |
C | //Author:- Amit Kumar
#include<stdio.h>
struct test
{
char a;
char b;
int i;
char c;
char d;
}__attribute__((packed)) test1;
int main()
{
printf("%lu",sizeof(test1));
}
|
C | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
//main()
//{
// int i, j, n, m;
// int a[16] = { 0 };
// int clrscr();
// printf("֣0~32767\n");
// scanf("%d\n", &n);
// for (m = 0; m < 15; m++)
// {
// i = n % 2;
// j = n / 2;
// n = j;
// a[m] = i;
// break;
// }
//
// for (m = 15; m >= 0; m--)
// {
// print... |
C | #include<stdio.h>
#include "common.h"
void test_delete_link_node();
int main()
{
test_delete_link_node();
}
typedef struct LNode LNode;
struct LNode{
int value;
LNode* next;
LNode(int val,LNode* next):value(val),next(next){}
};
void print_lnode(const LNode* head)
{
while(NULL != head){
... |
C | /*************************************************************************
> File Name: GetNumOfKey.c
> Author: cyf
> Mail: 1097189275@qq.com
> Created Time: 2016年03月24日 星期四 09时23分12秒
************************************************************************/
#include "GetNumOfKey.h"
/*
* 得到数组中第一个查找的数字的下标
* */
... |
C | /*
** main.c for emacs in /home/jules/CPE/CPE_2016_BSQ
**
** Made by Jules Spender
** Login <jules.spender@epitech.eu@epitech.net>
**
** Started on Thu Dec 8 15:04:25 2016 Jules Spender
** Last update Sun Dec 18 19:45:56 2016 Jules Spender
*/
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <s... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mainVersionFinale.h"
#define MAX_PERSONNE 200
#define MAX_ID 200
#define GRAND_TAB 100
//seulement 2 donc on s'arrete à 6
#define GENERATION 6
int main(){
person Test[MAX_PERSONNE+1];
//Affectaction et ouverture du fichier
FILE *fic= fopen(... |
C | #include <stdio.h>
int main()
{
int num1, num2, num3;
float d;
printf("\nDigite o primeiro numero: ");
scanf("%d", &num1);
printf("\nDigite o segundo numero: ");
scanf("%d", &num2);
printf("\nDigite o terceiro numero: ");
scanf("%d", &num3);
d = ((num1 * num1 + num2 *... |
C | #include <stdio.h>
#include <stdlib.h>
// プロトタイプ宣言
void swap(int *x, int *y);
int main(int argc, char *argv[])
{
int a,b;
// 引数の数を検査
if(argc != 3) {
printf("Usage : %s <number1> <number2>¥n", argv[0]);
return 0;
}
a = atoi(argv[1]);
b = atoi(argv[2]);
// 値ではなく、値のあるアドレスを渡す
swap(&a,... |
C | /*
Small C program that uses a function in another file.
Intended as part of an example of how to use Makefiles.
Jim Teresco, Williams College, The College of Saint Rose, Siena College
*/
#include <stdio.h> /* for printf */
#include <stdlib.h> /* for atoi */
#include "sub.h" /* for our function */
int mai... |
C | #include <stdio.h>
int main()
{
int x = 2, y, z;
x *= 3 + 2;
printf("\nx = %d", x);
x *= y = z = 4;
printf("\nx = %d", x);
x = y == z;
printf("\nx = %d", x);
x == (y = z);
printf("\nx = %d", x);
return 0;
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
/*
* Implementace jednoduche hadaci hry.
* Author: Jakub Kulik
*/
/* Definovane konstanty pro nabarveni textu terminalu. */
#define RED "\x1b[31m"
#define GREEN "\x1b[32m"
#define YELLOW "\x1b[33m"
#define BLUE "\x1b[34m"
#define ... |
C | //preprocessor directive
#pragma once
//this is a macro that replaces ITERATE_NODES with code inside for loop
//this is also a variadic function - a function that takes variable arguments
//required arguments are START, NAME, END. Elipses (...) indicate variable args
#define ITERATE_NODES(START, NAME, END, ...) ... |
C | /*
Alloc测试程序
1. Alloc申请测试
2. Free空洞测试
3. 首次适应算法测试
*/
#include"types.h"
#include"stat.h"
#include"user.h"
#define KB (1024)
#define ALLOC_NUM 6
char buf[100];
void Block(const char* msg){
printf(0, (char*)msg);
gets(buf, 100);
}
int main(){
void* addr[ALLOC_NUM];
Bloc... |
C | #include<stdio.h>
int main()
{
int test_cases;
scanf("%d",&test_cases);
while(test_cases--)
{
int t,b,num1,num2,ans=0,y=1,d1,d2,x;
scanf("%d%d%d%d",&t,&b,&num1,&num2);
while((num1)||(num2))
{
d1 = num1%b;
d2 = num2%b;
num1 /=b;
num2 /=b;
x = (d1+d2)%b;
ans += x*y;
y *=b;
}
printf("%... |
C | #include <stdio.h>
#include <stdlib.h>
#include "../include/main.h"
int tt = 0, tot_tt = 0, wt = 0, tot_wt = 0;
void initialize_vars()
{
tt = 0, wt = 0, tot_wt = 0, tot_tt = 0;
}
void first_process(ProcessStruct process)
{
printf("******************\n");
printf("Process %d\n", process.id);
printf("Wa... |
C | /********************************************************************/
/* Author : Mahmoud Alaa Elwelily */
/* Date : 29 Jan 2019 */
/* Version : V01 */
/* Description: This header file is ... |
C | #include<stdio.h>
#include<stdlib.h>
void merge(int *arr, int low, int mid, int high){
int n1 = mid-low+1, n2 = high-mid, i=0, j=0, k = low;
int left[n1], right[n2];
for(i=0;i<n1;i++)
left[i] = arr[low+i];
for(i=0;i<n2;i++)
right[i] = arr[mid+i+1];
i=0;
while(i<n1 && j<n2){
if(left[i]<=right[j])
a... |
C | // Minimal C11 linked list
//
#ifndef __MINLLIST__
#define __MINLLIST__
#include <stdbool.h>
struct dlnode{
void* data;
struct dlnode* prev;
struct dlnode* next;
};
// Operations on list nodes. Use with caution. Not as safe as below.
struct dlnode *dlnode_new(void*);
void dlnode_free(struct dlnode*);
voi... |
C | #include <stdio.h>
struct Cliente{
int idade, matricula;
float apolice;
char nome[20];
char estadocivil;
};
float mediapolice(struct Cliente *a, int n){
float soma = 0;
int i;
for(i = 0; i < n; i++){
soma += a[i].apolice;
}
return soma/n;
}
int maior_apolice(struct Cliente *... |
C | #ifndef __FIGHTER_H
#define __FIGHTER_H
#include "constants.h"
#include "devices.h"
#include "sprites.h"
/** @defgroup fighter fighter
/* @{
*
* Classe que representa um personagem do jogo
*/
/** @name stance_t */
/**@{*/
typedef enum
{
stand1,
stand2,
walk1,
walk2,
walk3,
walk4,
LA1,
LA2,
MA1,
MA2,
HA... |
C | #include "rogue.h"
void render(Game* game) {
clear();
print_gamehub(game->levels[game->current_level - 1]);
draw_level(game->levels[game->current_level - 1]);
}
int game_loop(Game* game) {
int ch = '\0';
Position* new_position;
Level* level;
if (game->current_level == 0) {
game->levels[game->current_level] ... |
C | /**
* time_julian_day.c
*
* Created on: Feb 20, 2017
* Author:
*/
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <math.h>
#include "time_julian_day.h"
#include "time_calendar.h"
/**
* error occurs here.
* time_julian_day.o:time_julian_day.c:(.rdata+0x0): multiple defin... |
C | #include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include "command.h"
/* Get the full path of a command */
void get_command_path(char* command_name, char* path)
{
FILE *fp;
// Exec the command
char command[MAX_STRING_LENGTH];
strcpy(command, "which ");
str... |
C | //
// main.c
// Quesiti
//
// Created by Rocco Carpi on 05/02/21.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, const char * argv[]) {
FILE *f;
f = fopen("quesiti.txt", "r");
char c = 0;
int input;
int stampa = 0;
if (!f)
{
printf("error... |
C | /**
*
* MQTT/UDP project
*
* https://github.com/dzavalishin/mqtt_udp
* Copyright (C) 2017-2018 Dmitry Zavalishin, dz@dz.ru
*
*
* Packet send
*
**/
#include <sys/types.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "mqtt_udp.h"
#define BUFLEN PKT... |
C | #include "cp1headers.h"
/*=================momentum.c=================
*Marches u and v for diffusion and convection (not PG), applies BCs, and evaluates source terms for PPE
*/
void momentum(int nx, int ny, float* u, float* v, float* uh, float* vh, float* s, float amu, float dx, float dy, float dt){
floa... |
C | #include <stdio.h>
int main()
{
int arr1[10][10],arr2[10][10],arr3[10][10],sum=0;
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
scanf("%d",&arr1[i][j]);
}
}
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
scanf("%d",&arr2[i][j]);
}
}
for(int ... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | /*
* Starter image:
* Load and place an image using various options for scaling and positioning
*
* Place the image it its original size.
* Place the image with scaling and orientation to the west.
* Fit the image into a box with clipping.
* Fit the image into a box with proportional resizing.
* Fit the image i... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: ... |
C | #pragma once
//һеk㡣
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x)
:val(x)
, next(NULL)
{}
};
ListNode* FindKthToTail(ListNode* pListHead, unsigned int k)
{
assert(pListHead != NULL);
//ָ룬֮IJֵΪk
ListNode* first = pListHead;
ListNode* second = pListHead;
unsigned int i = k;
int count ... |
C | #include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
char path[] = {"/tmp/socket3.3.6"};
/* socket name */
main(void)
/*
**
Listing3.6.c - UDP communication with a forked subtask
*/
{
struct sockaddr_un... |
C | /*
* src/parser.c -- shell parser
*
* David Vargas
* CSCI 4334-01 Operating Systems
* Professor David Egle
* University of Texas Rio Grande Valley
*
* Programming Project One
* Due 09/30/16
*
*/
/* standard c header files */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* GNU readline specifi... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
#define MAX_LEN 100
void input_handler(int num)
{
printf("globalfifo: Receive a signal form globalfifo, signalnum: %d\n", num);
}
int main(void)
{
int oflages;
... |
C | #include <stdio.h>
#include <string.h>
#define TEST(x) test(x, #x)
#include "myfilesystem.h"
/* You are free to modify any part of this file. The only requirement is that when it is run, all your tests are automatically executed */
/* Some example unit test functions */
int success() {
return 0;
}
int failure() ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* p_operand.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <assert.h>
#include <unistd.h>
const int BUFF_SIZE = 512;
const char* _EOF_ = "$EOF";
const char* _FIN_ = "$FIN";
int main(int argc, char* argv[] ){
... |
C | /*
1、front and end is where?
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define Error -1
typedef struct Node
{
int data;
struct Node *next;
}Qnode;
typedef struct
{
Qnode *front;
Qnode *end;
}Queue;
Queue *CreatQueue();
void add(int x,Queue *que);
int delete(Queue *que);
i... |
C | #include "header.h"
#include "util.h"
#include "svpng.inc"
#include <math.h>
#include <stdio.h>
extern double xpos, ypos;
extern double deltaX, deltaY;
extern double lastX, lastY;
extern int button_press_state;
extern double totalOffX, totalOffY;
extern double ratio;
// if get ESC
// then exit
void key_press_call... |
C | /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "cryptolib.h"
#include "file_keys.h"
#include "host_common.h"
#include "ti... |
C | #include <stdio.h>
#include "match.h"
int check(int expected, const char pattern[], const char text[])
{
int result = best_match_index(pattern, text);
if(result != expected) {
printf("--- TEST FAILED WITH pattern: \"%s\", text: \"%s\" ---- returned %d instead of %d\n", pattern, text, result, expected)... |
C | #include <stdio.h>
#include "testlib.h"
#include "testlib2.h"
int do_test(int num) {
int num_squared = square(num);
int i;
for (i = 0; i < num_squared; i++) {
printf("%d Hello\n", i+1);
}
return num;
}
|
C | #include <windows.h>
#include <stdio.h>
#include <pthread.h>
#include "parm.h"
#include "function.h"
//
float **MakeMatrix(int N)
{
srand((unsigned int)time(0));
float **Matrix;
Matrix=(float**)malloc(N*sizeof(float*));
for(int i=0; i<N; i++)
{
Matrix[i] = (float*)malloc(N*sizeof(float));
... |
C |
/*
* fd_seri.c
* Written by SW. YOON
*/
#include<stdio.h>
#include<fcntl.h>
#include<sys/socket.h>
int main(void)
{
int fdes1, fdes2, fdes3;
fdes1 = socket(PF_INET, SOCK_STREAM, 0); //소켓 생성
fdes2 = open("test.dat",O_CREAT);
fdes3 = socket(PF_INET, SOCK_DGRAM, 0);
printf("첫번째 파일 디스크립터 : %d\n", fdes1);
... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdint.h>
#include "forksrv.h"
int main(int argc, char *argv[]) {
int ctl[2], st[2];
pipe(ctl);
pipe(st);
pid_t chld = fork();
if (!chld) {
/* Child process */
dup2(ctl[0], FD_CTL_READ_END);
dup2(st[1... |
C | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include "fila.c"
int main (){
setlocale (LC_ALL,"Portuguese");
Fila *filaptr;
int nome,aux,aux2,i;
filaptr = Criafila();
if (filaptr == NULL){
printf("\nOcorreu um erro");
return 0;
} else {
printf("\nO endereo da fila criada... |
C | #include "/players/pavlik/guild/defs.h";
#define NOTES "players/pavlik/guild/log/bboard_notes"
string messages;
string new_hd;
string new_body;
int num_messages;
object who;
id(str) {
return str == "bboard" || str == "board";
}
short() {
return "The Message Board ["+num_messages+"]";
}
long() {
write(
"A sm... |
C | #include <event2/event.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
void sigint_event_function(evutil_socket_t fd, short sig_num, void *arg)
{
struct event_base *base = (struct event_base *)arg;
printf("Caught signal %d\n", sig_num);
event_base_loopexit(base, NULL);
}
int main(int argc, ... |
C | int min(int A[],int k,int N)
{
int LOC,j;
int MIN=A[k];
LOC=k;
for(j=k+1;j<=N-1;j++)
{
if(MIN>A[j])
{
MIN=A[j];
LOC=j;
}
}
return LOC;
}
void main()
{
int A[]={33,11,66,88,98,77,44,56,22,1};
int LOC,i,k,temp;
for(k=0;k<=8;k++)
... |
C | #include "headers.h"
int builtin_history(char **args, int arg_count)
{
if (arg_count > 2)
{
fprintf(stderr, "Too many arguments\n");
return EXIT_FAILURE;
}
FILE *fp = fopen(PATH_TO_HISTORY_FILE, "r");
if (fp == NULL)
{
perror("fopen() error");
return EXIT_FAILU... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*Write the program tail, which prints the last n lines of its input.
By default, n is 10, lets us say, but it can be changed by an optional
argument, so that
tail -n
prints the last n lines. Write the program so it makes the best use of a... |
C | #include<stdio.h>
#include<string.h>
int main()
{
int i,n,j;
char str1[50];
printf("Enter the string\n");
gets(str1);
puts(str1);
n=strlen(str1);
for(i=0;i<n;i++)
{
if(str1[i]==' ')
{
for(j=i;j<n;j++)
{
str1[j]=str1[j+1];
... |
C | /** \file constants.h
* Файл определяет константы, необходимые для работы программы
*/
#ifndef SATELLITE_PROPAGATION_CONSTANTS_H
#define SATELLITE_PROPAGATION_CONSTANTS_H
#include <math.h>
#define SEC_IN_DAY 86400.000000000000000000000 ///< Число секунд в дне
#define JULIAN_C 36525.00000000000000000000000 ///< Дней... |
C | //
// main.c
// Exercise 8
//
// Created by Changheng Chen on 11/4/16.
// Copyright © 2016 Changheng Chen. All rights reserved.
//
#include <stdio.h>
int main()
{
int x=2;
int y;
int z;
x*=3+2;
printf("x=%d\n", x); // x = x*(3+2) = 2*(3+2) = 10
x*=y=z=4;
printf("x=%d\n", x); ... |
C | #include "all_tests.h"
#include "kernel.h"
#include "syscall.h"
#include "test_helpers.h"
#include "priorities.h"
static int flag;
static int did_run;
static int parent_tid;
static int child_1_tid;
static int child_2_tid;
static void user_task3() {
child_2_tid = MyTid();
int p_tid = MyParentTid();
assert_int_... |
C | #include "tree.h"
#include <stdio.h>
#include <stdlib.h>
SearchTree InitTree();
int main(int argc, char *argv[]) {
SearchTree tree = InitTree();
printf("High:%d\n", High(tree));
PrintTree(tree);
printf("find 3 element position is %p \n", Find(6, tree));
printf("make empty tree\n");
tree = MakeEmpty(tree);
... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
char s1[20],s2[20];
int i;
clrscr();
printf("\n enter the two string\t");
scanf("%s%s",s1,s2);
printf("\n %s%s",s1,s2);
getch();
}
|
C | #include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include "dir_mutex.h"
int readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz)
{
int rc;
if(pthread_mutex_lock(&dir_mutex) < 0) {
perror("pthread_mutex_lock");
return -1;
}
if(fchdir(dirfd) < 0) {
perror("fchdir");
goto err_unloc... |
C | #include <stdio.h>
/*Adding break statements to ex10*/
int main(int argc, char *argv[])
{
int i = 0;
//a string array!
char *states[] = {
"California", "Oregon", //NULL, it just prints (null)
"Washington", "Texas"
};
/*
NULL is a value. It is the default value assigned to a pointer of a specific type. ... |
C | #include<stdio.h>
#include<time.h>
int bin(int a[],int start ,int end,int key )
{
int mid;
mid =start +(end- start)/2;
if (key==a[mid])
{
printf("Emement found at %d",mid);
}
else if (a[mid] > key)
{
return bin (a,start,mid-1,key);
}
else
{
return bin(a,mid+1,end,key);
}
return -1;
}
void main()
{
int a[100];
int key... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
/* Part A: Time Difference - STARTS */
/* Structure to input the time */
struct time{
int hours;
int minutes;
int seconds;
};
/* function to convert the time in seconds */
int numSeconds(int hours, int minutes, int seconds){
... |
C | #include <stdio.h>
#include <string.h>
char a[55];
int d[55];
int main(){
fgets(a, 55, stdin);
a[strlen(a)-1]=0;
for (int i=0; i<strlen(a); i++){
d[i]=1;
for (int j=0; j<i; j++){
if(a[j]<a[i]) d[i]=d[i]>d[j]+1?d[i]:d[j]+1;
}
}
int ans=0;
for (int i=0; i<55; i++) ans=ans>d[i]?ans:d[i];
printf("%d\n"... |
C | /*
Colaberated with James Romerro
Made for CPSC 380
By Cameron Wang
Refernces:
Class notes and examples
*/
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/ipc.h>
int main(int argc, char * argv[])
{
pid_t pid;
FILE *input_file, *output_file;
char file_b... |
C | #include <stdlib.h>
#include <stdio.h>
struct node
{
int info;
struct node *lchild;
struct node *rchild;
};
typedef struct node* NODE;
NODE getNode()
{
NODE x;
x=(NODE)malloc(sizeof(struct node));
return x;
}
NODE create_BT()
{
NODE temp;
int ele;
printf("Enter element(-1 for no data):\n");
scanf("%d",&ele);... |
C | #include <stdio.h>
#include <unistd.h>
// i *= 2 means i = i*2, we are squaring i
int main(){
for(int i = 1; ; i*=2){
printf("%i\n", i);
sleep(1);
}
}
// can stop a loop with control-C
|
C | #ifndef LISTA_H
#define LISTA_H
typedef struct node {
char peca;
int indice;
struct node *proximo;
struct node *anterior;
} node_t;
typedef struct {
int num_elementos;
node_t *inicio;
node_t *fim;
} lista_t;
lista_t *cria_lista();
void insere_final(lista_t *lista, char letra);
void in... |
C | #include "cs165_api.h"
#include "hashjoin.h"
#define HASH_TABLE_SIZE 128000
ht_node *hash_table[HASH_TABLE_SIZE];
int hash(data n) {
return n % HASH_TABLE_SIZE;
}
void add_to_ht(int pos, data val) {
int bucket = hash(val);
ht_node *new = malloc(sizeof(ht_node));
new->pos = pos;
new->val = val;
... |
C | /*Guillermo Ortega Romo 14/10/17*/
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<unistd.h>
int dado();
int main()
{
srand(time(0));
int p1=0, p2=0;
int q1=0, q2=0;
int j1, j2;
printf("Tiros de dado\n\n");
printf("| Tiro |Jugador 1|Jugador 2|\n");
for(int i=0;i<20;i++)
{
j... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.