language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
//声明文件指针
FILE * fp;
//fopen 打开文件
//第一个参数是文件路径,建议使用绝对路径
//第二个参数是操作模式
//w:只写,如果文件不存在,会创建文件;如果文件存在且有内容,则会清空内容,准备重写
//r:只读,如果文件不存在,不会得到文件指针
//a:追加,在文件末尾追加内容,文件不存在不会得到文件指针
//后面都可以写上‘+’代表读写兼容
... |
C | #include <unistd.h>
int main() {
for(int i =0 ; i < 2; i ++){
execl("/bin/ls", "ls", NULL);
sleep(5);
printf("What happened?\n");
}
}
|
C | // #include <stdio.h>
#include <stdlib.h>
// #define BUFFER_LENGTH 100
// typedef struct node {
// char *value;
// struct node *next;
// } Node;
// struct node *newList()
// {
// Node *head = (Node*)malloc(sizeof(Node));
// head->value = (char*)malloc(sizeof(char) * BUFFER_LENGTH);
// head... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
char *get_last_token(char path[]) {
char *token;
token = strtok(path, "/");
char *last_token;
while (token != NULL) {
last_token = token;
token = strtok(NULL, "/");
}
return last_token;
}
int main(int argc, char *argv[]... |
C | /*
* Copyright 2016 Aaron Barany
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
C | // Exercise 2-2.
// Write a program that prompts for input of the length and width of a room in feet and inches, and then calculates and
// outputs the floor area in square yards with two decimal places after the decimal point.
#include <stdio.h>
int main(void)
{
long int lengthFeet, widthFeet, lengthInches, width... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "utils.c"
#define SIZE (sizeof(int) * 4)
static int fibonacci_matrix_mul(int fr[2][2], int ff[2][2])
{
int frr[2][2];
int i = 0, j = 0, k = 0;
for (i = 0; i < 2; i++) {
for (j = 0; j < 2; j++) {
... |
C | #include <iostream>
int main(){
int x,y;
std::cout<<"Enter two numbers: ";
std::cin>>x>>y;
int result=x*y;
if(result>100){
std::cout<<"The result is HIGH";}
else{
std::cout<<"The result is LOW";
result;
}
}
|
C | /*
** my_hashmap_remove.c for libmy in /home/benji_epitech/workdir/perso/libmy/tmp/lib/my
**
** Made by Benjamin Viguier
** Login <benjamin.viguier@epitech.eu>
**
** Started on Thu Apr 27 18:16:25 2017 Benjamin Viguier
** Last update Thu Jun 1 11:34:51 2017 Benjamin Viguier
*/
#include <stdlib.h>
#include "libmy... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <signal.h>
#include <syslog.h>
#include <string.h>
#include <errno.h>
//--------------------------------------------------------------------
// Global variables
//-------------------------------------------... |
C | //store 10 students info and display it
#include <stdio.h>
struct student
{
char name[50];
int roll;
float marks;
} s[10];
int main()
{
int i;
printf("Enter information of students:\n");
for(i=0; i<10; ++i)
{
s[i].roll = i+1;
printf("\nFor roll number%d,\n",s[i].roll);
... |
C | #include "types.h"
#include "user.h"
int global_array[2048] = {0};
int global_var = 0;
void testcase4(){
int pid;
printf(1,"\n----- Test case 4 -----\n");
printf(1,"[prnt] - before fork - ");
print_free_frame_cnt();
if((pid = fork()) == 0)
{
//child
sleep(50);
printf(... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct node{
int num;
struct node *next;
} Node, *NodePtr;
int main()
{
int lenght(NodePtr top){
int n = 0;
NodePtr curr = top;
while(curr != NULL){
n++;
curr = curr -> next;
}
return n;
}
return 0;
}
|
C | /*
** Compute the martingale residual for a counting process model
** This routine is only used by the exact partial likelihood routine
** agexact.fit, which has such low usage that it and components have
** not been coverted to faster algorithms as other routines have.
**
** Input
** n number of s... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "heap_lib.h"
int
main (int argc, char *argv[])
{
int arr1[] = {1, 2, 3, 4, 5};
int arr2[] = {6, 7, 8, 9, 10};
int arr3[] = {11, 12, 13, 14, 15};
int arr4[] = {16, 17, 18, 19, 20};
int arr5[] = {21, 22, 23, 24, 25};
int size = sizeof(arr1)/sizeof... |
C | #include "list.h"
#include <stdio.h>
void ListInit(LinkedList *list) {
list->head = NULL;
list->tail = NULL;
list->len = 0;
}
void listInit1(LinkedList *list,Item *item){
list->tail = item;
list->head = item;
list->len = 1;
item->next = NULL;
}
void listAdd(LinkedList *list,Item *item){
... |
C | /* Chapter 17 Exercise 13 */
/* The following function is suppose to new node into its proper place
* in an ordered list. Unfortunately, the function doesn't work correctly
* in all cases. Explain what's wrong with it and show how to fix it.
* Assume the node structure is the one defined in Section 17.5.
*/
struct... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
/*
Entradas: -argc: Entero que indica el número de argumentos ingresados en la linea de comandos
-argv: Arreglo con las entradas ingresadas por linea de comandos
-*num_img: Puntero a variable entera que representa el número d... |
C | #include <stdio.h>
int main(void)
{
//4.a
// int *ptr;
// int torf[2][2] = {12, 14, 16};
// ptr = torf[0];
// printf("*ptr=%d, *(ptr+2)=%d\n", *ptr, *(ptr+2));
// printf("ptr=%p, ptr+2=%p\n", ptr, ptr+2);
//4.b
// int * ptr;
// int fort[2][2] = {{12}, {14, 16}};
// ptr = fort[0];
// printf("fort[... |
C | #define _GNU_SOURCE
#include "process.h"
#include "scheduler.h"
#include <stdlib.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sched.h>
#include <assert.h>
#define rep(start, n) for(int i = start; i < n; ++i)
/* current unit time */
static int currt;
/* currently run... |
C | /* vim: set fileencoding=utf-8 tabstop=8 noexpandtab */
#ifndef _PIXMAP_H_
#define _PIXMAP_H_
typedef struct
{
unsigned int width;
unsigned int height;
unsigned int bpp;
unsigned char *pixels;
} Pixmap;
size_t pixmap_size(const Pixmap *pixmap);
Pixmap * pixmap_create(unsigned int width, unsigned int height, unsi... |
C | #include <stdio.h>
#include <stdlib.h>
#include "auxiliary.h"
#include "LinkedList.h"
#include "Controller.h"
#include "Employee.h"
#include "dataEntry/input.h"
#define SIZEPATH 100
#define TRUE 0
#define FALSE -1
/****************************************************
Menu:
1. Cargar los datos de los empleados desde... |
C | #include <stdio.h>
typedef struct Element Element;
struct Element
{
int data;
Element *next;
};
typedef struct LinkedList LinkedList;
struct LinkedList {
Element *first;
int length;
};
LinkedList *init(int elementValue) {
LinkedList *list = malloc(sizeof(*list));
Element *element = malloc(siz... |
C | #include <stdio.h>
int greedy_check(int *x, int n, int k, int m) // Gáum gráðugt hvort kisunum megi raða með m millibili.
{
int i, j, r = 0;
for (i = 0, j = -2*m; i < n; i++) if (x[i] >= j) j = x[i] + m, r++; // Látum kisu lengst til vinstri, síðan á næsta löglega reit, o.s.... |
C |
-------------------
exit |
-------------------
void exit (int)
* ˳
* ִ atexit() ӵлص
* ˢ,رд,ر tempfile() ʱļ,ѿȨ,ֹ״̬
-------------------
atexit |
-------------------
int atexit (void (*)(void));
* úһָ
* ÷Զε,ٿԷ32ص
* ڳ˳ʱ,ø÷(ӵִ)
void f1(){
printf("һִ\n");
}
void f2(){
printf("ڶִ\n");
}
int m... |
C | #include <stdio.h>
int
main(int argc, char **argv)
{
int trinum = 0;
int factors = 0;
for (int index = 1; factors < 500; trinum += index++) {
int candidate;
for (factors = 0, candidate = 1;
candidate * candidate <= trinum;
++candidate) {
if (trinum % candidate == 0) {
factors += 2;
}
}
}
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* shortest_path.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <string.h>
#include "proj2.h"
#include "proj3.h"
extern FILE *treelst;
extern tree DisplayTree;
extern int error;
void assignment_semantic(tree T);
void argument_semantic(tree T);
void array_init_semantic(tree T, int dimension, int arr);
void variable_init_semantic(tree T, int dimension, i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
int main() {
int rc = fork();
if (rc < 0) {
fprintf(stderr, "fork failed\n");
exit(1);
}
// child
else if (rc == 0) {
printf("hello from %d\n", getpid());
}
// parent
else {
waitpid(rc, NULL, 0);
printf("goodbye from %d... |
C | /*
ATTENTION: This code designed for Linux, it does not work on Windows.
*/
/*
ATTENTION: Do not delete the "messages" folder within the directory of the source files.
If there is not such a folder, then create it.
*/
/*
Programming Languages - Autumn 2017 - Semester Project
A multi-user chat pro... |
C | #ifndef MICROMOUSE_CELL_VECTOR_H
#define MICROMOUSE_CELL_VECTOR_H
#include "src/main/c/com/micromouse/maze/cell.h"
typedef struct Vector_c {
int size;
int capacity;
Cell** data;
bool tight;
} Vector_c;
// Constructs a vector with an initial size of 10.
Vector_c* make_vector_c();
// Constructs a vector with ... |
C | //设有n种不同面值的硬币,各硬币的面值存于数组T[1:n]中。
//现要用这些面值的硬币来找钱。可以使用的各种面值的硬币个数存于数组Coins[1:n]中。
//对任意钱数0≤m≤20001,设计一个用最少硬币找钱m的方法。
#include<stdio.h>
int T[11],Coins[11],n;
int c[2013],num[2013];
int main(int argc, char* argv[])
{
int i,j,m;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<n;++i)
scanf("%d%d",&T... |
C | #include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <wait.h>
#define size 4
void manejador(int s){
};
int main(){
pid_t hijos[size], parent;
int i;
signal(SIGUSR1, manejador);
parent = getpid();
for(i=0; i<2; ++i) {
if(!(hij... |
C | #include "contiki.h"
#include "net/rime.h"
#include "listen.h"
#include "timesync.h"
#include <avr/io.h>
#include <stdio.h>
#include <string.h> // for memset
static int last;
static int tmp;
static unsigned int result;
static int ringBuf[64];
static int ringIndex = 0;
static char ringBufDif[64];
static int ringInde... |
C | #include <stdio.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#define BUFF_SIZE 1024
#define PORT 8000
pthread_mutex_t s = PTHREAD_MUTEX_INITIALIZER;
int client_id= -1;
void *handle_client(vo... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <pthread.h>
/************* globals **************/
#define NUMTHREADS 2
// mutex and cond variable
pthread_mutex_t sharedElementMutex; // mutex for access to shared "data"
pthread_cond_t canConsumeConditi... |
C | #include <check.h>
#include <limits.h>
#include <stddef.h>
#include <fontconfig/fontconfig.h>
START_TEST (test_range_create_double_destroy)
{
FcRange *range;
// Normal range
range = FcRangeCreateDouble(0.0, 1.0);
ck_assert(range != NULL);
FcRangeDestroy(range);
// Single number range
ran... |
C | #include <stdio.h>
#include <unistd.h>
// for alignment to long
typedef long Align;
// block Myheader
union header {
struct {
// *ptr;
union header *next;
unsigned size;
} s;
// for alignment
// x
Align alignment;
};
typedef union header MyHeader;
// base;
static MyHeader... |
C | #include<stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{
char string[500];
int i=0;
printf("Enter the string : ");
scanf("%s",string);
while(string[i])
{
string[i] = tolower(string[i]);
i++;
};
printf("The string in lowercase : %s", string);
printf("\n");
return 0;
}
|
C | /*
Autor: mhcrnl@gmail.com tel:0722270796
Numar perfect este un numar al carui divizori, excluzând
insasi numarul, adunati dau numarul initial.
6 >> 1+2+3=6
28 >> 1+2+4+7+14=28
alte numere perfecte 496, 8128
programul numarperfect1.c - cauta numerele perfecte in intervalul ales de dvs..
*/
#... |
C | #include "stack.h"
// ========================================================================= //
void stack_init(Stack *s){
printf("stack: Initializing\n");
s->top = NULL;
s->size = 0;
return;
}
void stack_clear(Stack *s){
printf("stack: Clearing\n");
Node *temporal = NULL;
while(s->top != NULL){
... |
C | //
// malloc_Debug.h
// libmalloc
//
// Created by 王举范 on 2018/12/17.
//
#ifndef malloc_Debug_h
#define malloc_Debug_h
/********* Debug helpers ************/
extern void malloc_zone_print_ptr_info(void *ptr);
/* print to stdout if this pointer is in the malloc heap, free status, and size */
extern boolean_t mall... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../libs/compress.h"
#include "../libs/huffman_tree.h"
void get_trash_size(NODE_TREE *tree, int height, U_CHAR *trash_size)
{
if (!isEmptyTree(tree))
{
if (isLeaf(tree))
{
*trash_size += tree->frequency * height;
... |
C | #include "stm32f10x.h"
#include "sys.h"
#include "delay.h"
#include <stdio.h>
#include "KEY.H"
#include "led.h"
extern float CH_Data[4]; //ֵͨ
extern int Init_flag;//FDC2214λ־
extern unsigned int Mode_flag;
extern unsigned int Mode3_Gesture_cnt; //¼ģʽ3,4Ƹ
extern unsigned int Mode4_Gesture_cnt; //¼ģʽ3,4Ƹ
float... |
C | #include <stdio.h>
#include <math.h>
int main()
{
double answer = tan(0.5);
printf("tan(0.5) = %f\n", answer);
return 0;
}
|
C | int jiaohuan(int);
int ss(int);
int main(){
int n,m,c=0,i,h[q];
scanf("%d%d",&n,&m);
for(i=n;i<=m;i++){
if(jiaohuan(i)==i&&ss(i)){
h[c]=i;
c++;
}
}
if(c==0)
printf("no\n");
else{
for(i=0;i<c;i++){
if(i==0)
printf("%d",h[i]);
else
printf(",%d",h[i]);
}
printf... |
C | #include <assert.h>
#include <inttypes.h>
int equal(int64_t, int64_t);
int not_equal(int64_t, int64_t);
int less(int64_t, int64_t);
int less_equal(int64_t, int64_t);
int greater(int64_t, int64_t);
int greater_equal(int64_t, int64_t);
int main(void) {
assert(equal(5, 3) == 0);
assert(not_equal(5, 3) == 1);
... |
C | #include <stdlib.h>
#include <assert.h>
#include <stdbool.h>
#define N 3
int Matrix[N*N]; //不回收
const int LineN = 2 * N - 1; //实际对角线数
typedef struct pos
{ int x;
int y;
} Position;
Position* mk_Pos(int x, int y){
Position* pos = malloc(sizeof(Position));
assert(x > 0 && y > 0);
pos->x = ... |
C | /* ------------------------------
$Id: ifile.c,v 1.3 2009/11/24 16:44:39 marquet Exp $
------------------------------------------------------------
File manipulation.
Basic version; access file via inode number.
Philippe Marquet, october 2009
*/
#include <stdlib.h>
#include <stdio.h>
#include <mem... |
C | #include <stdio.h>
#include <stdlib.h>
#include <check.h>
#include "ConverterTests.h"
#include "../src/GlobalDefines.h"
#include "../src/Converter.h"
START_TEST(test_convert_I_to_1)
{
ck_assert_int_eq(1, convertToArabic("I"));
}
END_TEST
START_TEST(test_convert_a_to_invalid) {
ck_... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int *scores,x;
scores = malloc(sizeof(int)*4);
if( scores == NULL)
{
puts("Unable to allocate memory");
return(1);
}
*(scores+0) = 100;
*(scores+1) = 97;
*(scores+2) = 105;
*(scores+3) = 110;
for(x=0;x<4;x++)
printf("Score %d: %d\n",x+... |
C | #include<stdio.h>
void add(int,int);
int main()
{
int num1=-5,num2=6;
add(num1,num2);
return 0;
}
void add(int x,int y)
{
int sum;
sum=x+y;
printf("%d",sum);
} |
C | /*
描述图层信息
buf 绘制的像素信息
bxsize bysize 绘制的宽高
vx0 vy0 移动后的左上角坐标
con_inv 表示透明部分
height 图层高度
flags 图层状态 是否被使用 1 use 0 no use
*/
struct SHEET {
unsigned char *buf;
int bxsize, bysize, vx0, vy0, col_inv, height, flags;
struct TASK *task;
};
/*
最大图层数
*/
#define MAX_SHEETS 256
/*
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
bool isLeapYear(int year)
{
return ((year % 4 == 0) && (year % 100 != 0));
}
int countDaysSoFar(int daysOfMonth[12], int month, int day)
{
int result = 0;
for (int i = 0; i < month; i++)
{
result += daysOfMonth[i];
}
result += day;
return result;
... |
C | /*-----------------------------------------------------------------------------
* Sorted set API
*----------------------------------------------------------------------------*/
/* ZSETs are ordered sets using two data structures to hold the same elements
* in order to get O(log(N)) INSERT and REMOVE operations into ... |
C | #include "bitwise_op.h"
unsigned int odd_bit_toggle (unsigned int *s_num)
{
unsigned int mask = -1;
if (!integer_valid (*s_num)) {
return FAILURE;
}
mask = (mask / 3) * 2;
*s_num = *s_num ^ mask;
return SUCCESS;
}
|
C | #include <stdio.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
void CS(int MY_PORT)
{
time_t s = time(NULL);
struct tm *current_time;
printf("Entering the critical sectio... |
C | /**
\file : DAC_FW.c
\brief : Firmware functions for DAC
\details :
\author : Tobias Bavasso Piizzi
\date : 12/01/2021
*/
#include "Aplication.h"
/*
The DAC is configured using the following registers:
1. Power: Use the PDRUNCFG register to power the DAC.
2. Peripheral clock: Use the SYSAHBCLKCT... |
C | #include <stdio.h>
int main(void)
{
int n = 0, count = 0;
scanf("%d", &n);
do
{
printf("%d", n % 10);
n /= 10;
++count;
} while( n > 0 );
printf(", number length is %d\n", count);
return 0;
}
|
C | #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
int f[50], p,i, st, len, j, c, k, a;
for(i=0;i<50;i++)
f[i]=0;
printf("Enter how many blocks already allocated: ");
scanf("%d",&p);
printf("Enter blocks already allocated: ");
for(i=0;i<p;i++)
{
scanf("%d",&a);
f[a]=1;
}
x: printf("E... |
C | /* Copyright (C) 2004 Mark Seaborn
This file is part of Plash.
Plash is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version... |
C | #include<stdio.h>
void main()
{
int a[10][10],i,j,m, n, s=0;
printf("Enter row and column of array: ");
scanf("%d%d",&m,&n);
printf("Enter elements : ");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
s=s+a[i][j];
}
}
printf("T... |
C | #ifndef SITE_H
#define SITE_H
#define MAX_BUF 1024
struct site
{
struct page *pages;
struct link *links;
};
struct page
{
char page_name[MAX_BUF] = {0};
struct page *head;
struct page *tail;
struct page *next;
struct page *prev;
};
struct link
{
char url[MAX_BUF] = {0};
struct link *head;... |
C | /*
* realizar un programa que ingrese desde teclado un numero positivo n y calcule la suma
* de los impares desde 1 hasta n, por ejemplo calcular la suma de los numero impares
* 1+3+5+...+(2*n-1)
*
*
*/
#include <stdio.h>
int main()
{
int n, sum= 0;
for(printf("Ingrese numeros impares:\n"); n!= 0; sum+=... |
C | #include<stdio.h>
#include<time.h>
#include<string.h>
#include<stdlib.h>
char seq_all[7]={'r','y','g','i','o','v'};
int i;
char seq_guess[4],char_guess[40],guess=' ', feedback1[4];
//function to get user input
int user_input()
{
printf("Enter 4 colors\n");
fgets(char_guess,sizeof(char_guess),stdin);
feedback(char_g... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
// Verifica tamanho do texto
int IsValid(char *src, int len, int tokenLen, char *token){
int i;
int lines = 1;
int flagToken = 0;
for(i=0; i<len; ++i){
if(src[i] == '\n')
lines++;
}
for(i=0; i<to... |
C | #include<iostream>
using namespace std;
int main()
{
int n,t;
cin>>n>>t;
int a[n][n],b[n][n];
int fill=1;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
a[i][j]=fill;
b[i][j]=a[i][j];
fill++;
}
}
int loop=t%4;
while(loop)
{
int column=n-1;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
b[j][column]=a[i][j];
}
column=col... |
C | #include "keyboard.h"
// key matrix scan function
uint8_t scan_col(uint8_t col) // ɨ
{
switch(col)
{
case 0:
KEY_MAT = ~0x8; // ~0000 1000
break;
case 1:
KEY_MAT = ~0x4; // ~0000 0100
break;
case 2:
KEY_MAT = ~0x2; // ~0000 0010
break;
case 3:
KEY_MAT = ~0x1; // ~0000 0001
break;... |
C | testprogramm {
int zahl1=0;
int zahl2=0;
int ergebnis = 0;
int eingabe=0;
int testzahl=5;
printf("Testzahl: ",testzahl);
printf("\n");
printf("Geben Sie eine Zahl ein: ");
scanf(eingabe);
if(eingabe>0) {
printf("Die eingegebene Zahl ist positiv.\n");
} else {
if (eingabe == 0) {
printf("Null")... |
C | #include <stdio.h>
int main(int argc, char **argv)
{
int year,chk,yearend,j,testyear;
chk = 0;
yearend = 2030;
int leaps[1000];
while (chk == 0){
printf("Insert a year up to %d\n",yearend);
scanf("%d",&year);
if (year < yearend && year >= 0){
chk = 1;
}
}
j = 0;
for (testyear = 0; testyear <= year; testyea... |
C | #include "cell.h"
void frog_jumps_in(Actor * self){
Cell * selfd = (Cell *)self->derived;
int data = self->additional_msg_buffer[0];
selfd->population_influx++;
if(data == 1 ){ // if the frog is infected increase infection level
selfd->infection_level++;
}
//reply with the population_infux and the infect... |
C | /*
// Author: Chris Hyman, chris@wugs.me
// Date: 6 Oct 2020
// A solution to Programming Exercises and Projects from
// Chapter 6 of C Programming: A Modern Approach by K. N. King
//
// 12. Modify Programming Project 11 so that the program continues adding terms
// until the current term becomes less than `epsilon`, w... |
C | #include <stdio.h>
#include "Question1.h"
#include "Question2.h"
int main() {
int menu = 0;
while (menu != 7) {
printf("1. Brute Force Algorithm for Inversions\
\n2. Divide and Conquer Algorithm for Inversions\
\n3. Compare Execution Time for Inversions\
\n4. Brute Force Algorithm for Convex Hull\
\n5. D... |
C | #include<unistd.h>
#include<stdlib.h>
#include<stdio.h>
#include<fcntl.h>
const char * test_file = "/tmp/test_lock";
int main()
{
int file_desc;
struct flock region_to_lock;
int res;
//打开文件描述符
file_desc = open(test_file, O_RDWR | O_CREAT, 0666);
if(!file_desc){
fprintf(stderr, "Unable ... |
C | //this program executes any bash cmd by passing it on using popen() then prints out the result
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
int main(int argc, char **argv){
char buff[256], line[256];
FILE *ptr;//file pointer
strcpy(line, argv[1]);// these concates the comm... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* draw_wall.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "lc3.h"
/* change endianness */
uint16_t swap16(uint16_t x)
{
return (x << 8) | (x >> 8);
}
uint16_t *read_image(const char *path)
{
FILE *file = fopen(path, "rb");
if (!file)
{
printf("[-] Read error!");
... |
C | /*program to get and handle signal from other process
and the do whatever process we wanna to do.
Here i modified code to kill the process by python program kill.py */
#include<stdio.h>
#include<signal.h>
#include<unistd.h>
#include<stdlib.h>
void sig_handler(int signo)
{
if (signo == SIGTERM){
printf("received SIG... |
C | #include <stdio.h>
int main(){
int valor,n100,n50,n20,n10,n5,n2,n1,m50,m25,m10,m5,m1,moedas;
float valor2;
scanf("%f",&valor2);
valor= valor2;
moedas=(valor2 - valor)*100 + 0.9;
n100= valor/100;
n50=(valor%100)/50;
n20=((valor%100)%50)/20;
n10=(((valor%100)%50)%20)/10;
n5=((((valor%100)%50)%20)%10)/5;
... |
C | #include <stdio.h>
#include <libugomemo.h>
int main(void) {
FILE *f;
uint file_size, i;
u32 crc32;
u8 *buffer;
/* Reading the license file for repeatability. */
f = fopen("LICENSE", "r");
if (!f) return 1;
/* Get the file's size. */
fseek(f, 0, SEEK_END);
file_size = ftell(f)... |
C | #ifndef __FLIT_H
#define __FLIT_H
#include <stdlib.h>
#define BROADCAST_ADJUSTED (0xffff)
/* ----------------------------------------------------
* buffer flit operations
*
* ----------------------------------------------------
*/
// get a flit from recv_buf, given the token id
uint64_t get_flit(uint8_t *recv_bu... |
C |
#pragma once
#include "DelaunayTable.Container.h"
#include <stdbool.h>
#include <stddef.h>
/// # Utility functions
extern void sort__size_t__Array(
size_t* sizes,
const size_t nSizes
);
static inline bool contains__size_t__Array(
const size_t nSizes0,
const size_t* const sizes0,
const s... |
C | #include <stdio.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glut.h>
static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
typedef struct gear_s
{
GLfloat radius_inner;
GLfloat radius_outer;
GLfloat width;
GLint tooth_count;
GLfloat tooth_depth;
} gear_t;
void drawGear(gea... |
C | #include <stdio.h>
#include <string.h>
//to implement func 'my_strlen' which is 'strlen' alike.
//Additionally, it cound handle strings without NUL-char in the end, generated by using 'strn-' functions.
unsigned int my_strlen(char string[], unsigned int array_space_len){
unsigned int len;
char *str_pt = string;
... |
C | /* Efetuar a leitura do nmero de quilowatts consumido e calcular o valor a ser
pago de energia eltrica, sabendo-se que o valor a pagar por quilowatt de
0,12. Apresentar o valor total a ser pago pelo usurio acrescido de 18% de
ICMS. */
#include <stdio.h>
#include <stdlib.h>
int main()
{
int qw;
float valor;
... |
C | # include <stdio.h>
# include "studs_score.h"
int input_score(int array[], int n)
{
int i=0;
int x;
int count=0;
while(1)
{
printf("输入第%d个学生的成绩:",count+1);
scanf("%d", &x);
if (x>=0 && x<=100)
{
array[count] = x;
count++;
}
else
break;
}
return count;
}
void print_score(int array[], int n... |
C | #include "lab2-api.h"
#include "usertraps.h"
#include "misc.h"
#include "procon.h"
void main (int argc, char *argv[])
{
circular_buffer *cb; // Used to access missile codes in shared memory page
uint32 h_mem; // Handle to the shared memory page
sem_t h_procs_sem; // Semaphore to signal the ori... |
C | #include <stdio.h>
#include "vector.h"
#include "vector2d.h"
#include "hashmap.h"
#include "bitwise.h"
#include "ecs.h"
#include "vector.test.h"
#include "vector2d.test.h"
#include "hashmap.test.h"
#include "bitwise.test.h"
#include "ecs.test.h"
int main() {
vector_test();
vector2d_test();
hashmap_test()... |
C | // 6.Write a C program to reverse a given string as below.C : Assignment on String Typing is no substitute for thinking
// TECHNORBIT INFOSYSTEMS Amol Rahane : 9545535857
// Eg:
// Input String: India is my country
// Output String: aidnI si ym yrtnuo
#include <stdio.h>
void main()
{
char str[100];
int firstCh... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* setenv.c :+: :+: :+: ... |
C | /* Тестовый пример, иллюстрирующий процедуры поиска oid по заданному криптографическому
механизму, а также использование oid для создания и удаления функций хеширования.
Пример использует неэкспортируемые функции.
test-internal-oid03.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <ak_oid.h>
#includ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lst_copy_op.c :+: :+: :+: ... |
C | //
// Created by cupid on 2017/9/11.
//
#include <stdio.h>
int main() {
int n = 0;
int m = 0;
scanf("%d", &n);
scanf("%d", &m);
int a[n + 1];
for (int i = 1; i <= n; ++i) {
a[i] = i;
}
for (int j = 0; j < m; ++j) {
int p = 0, q = 0;
scanf("%d %d", &p, &q);
... |
C | #include<stdio.h>
#define height 20
#define width 15
void clr(char *p)
{
int i,j;
for(i=0;i<height;i++)
for(j=0;j<width;j++)
*(p++)=' ';
}
int main()
{
int i,j,a=0;
char tufail[height][width];
clr(tufail);
while(1){
//PRINTING T
clr(tufail);
for(i=0;i<2;i++)
for(j=0;... |
C | #include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
int main() {
printf("Test playSmithy Start\n");
int k[10] = {adventurer, council_room, feast, gardens, mine, remodel, smithy, village, baron, great_hall};
int result, temp1, temp... |
C | /*
ṹ ָ
*/
#include<stdio.h>
struct Student{
char name[20];
char age;
char grade;
};
typedef struct Student Strstudent;
void show(Strstudent *);
int main()
{
Strstudent aa = {"˧",18,'A'};
Strstudent * paa;
paa = &aa;
show(&aa);
return 0;
}
void show(Strstudent * a)
{
printf("%s %d %c",a->name,a->age,a->gra... |
C | #include "i2c.h"
#include "gpio.h"
#include "type.h"
#include "mcu_regs.h"
#include "oled.h"
#include "light.h"
#define TAMANHOBUFFERENTRADA 32
#define TAMANHOBUFFERSAIDA 64
volatile char bufferEntrada[TAMANHOBUFFERENTRADA];
volatile char bufferSaida[TAMANHOBUFFERSAIDA];
int contadorLeituraBufferEntrada... |
C | #include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <Lista.h>
// strdup non e' C99, e' necessario il prototipo
// altrimenti non viene riconosciuta dal compilatore
char *strdup(const char *s);
// NOTA:
// alternativa con diversa interfaccia per la createList
// list_t *createLis... |
C | /**********************************************************************************
* [FILE NAME]: application_functions.c
*
* [AUTHOR]: Toka Zakaria Mohamed Ramadan
*
* [DATE CREATED]: Nov 5, 2020
*
* [Description]: File contain functions will be used
* in the applications for Human_Interface EC... |
C | #pragma once
#pragma region //Third-Pary Includes
#include <Box2D/Box2D.h>
#include "Box2D\Common\b2Draw.h"
#include "Box2D\Common\b2Math.h"
#include <GL/gl3w.h>
#include <ImGui/imgui.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_syswm.h>
//BOX2D HELPERS
//*************
#define b2_pidiv2 1.570796326795f
inline b2Vec2 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.